qt-creator

error: expected unqualified-id before 'if'

青春壹個敷衍的年華 提交于 2020-01-02 01:14:09
问题 I've googled this error until I'm blue in the face, but haven't been able to relate any of the results to my code. This error seems to be caused, usually, but misplaced or missing braces, parents, etc. It's also been a long time since I wrote any C++, so there could be some obvious, foolish thing that I'm missing. This is a Qt Mobile app that I'm writing in Qt Creator 2.4.0, Based on Qt 4.7.4 (64 bit) Built on Dec 20 2011 at 11:14:33 . #include <QFile> #include <QString> #include <QTextStream

Qt QML dropdown list like in HTML

為{幸葍}努か 提交于 2020-01-01 09:22:32
问题 Simple thing, but can't get find it. I want a simple dropdown selection box with a couple of selections. Like in HTML <select> <option>1</option> <option>2</option> </select> what is the code for QML for that ? 回答1: Here's a simple example that could maybe be used as a starting point: import QtQuick 1.0 Rectangle { width:400; height: 400; Rectangle { id:comboBox property variant items: ["Item 1", "Item 2", "Item 3"] property alias selectedItem: chosenItemText.text; property alias

Qt QML dropdown list like in HTML

萝らか妹 提交于 2020-01-01 09:22:03
问题 Simple thing, but can't get find it. I want a simple dropdown selection box with a couple of selections. Like in HTML <select> <option>1</option> <option>2</option> </select> what is the code for QML for that ? 回答1: Here's a simple example that could maybe be used as a starting point: import QtQuick 1.0 Rectangle { width:400; height: 400; Rectangle { id:comboBox property variant items: ["Item 1", "Item 2", "Item 3"] property alias selectedItem: chosenItemText.text; property alias

GLFW MinGW link error

社会主义新天地 提交于 2019-12-31 22:41:24
问题 I've been attempting to test out GLFW with C++ for quite a while and am having constant linker issues. I am fairly new to C++, although I have experience in Java and C#, working directly with the compiler is fairly new to me. Here's my setup information. IDE: Qt Creator OS: Windows 7 64-bit Compiler: MinGW32 4.8.1 01:23:26: Starting: "C:\MinGW\bin\mingw32-make.exe" C:/MinGW/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'A:/workspace_cpp/Test-Debug' g++ -Wl,-subsystem

How do you plot points in QT?

不羁岁月 提交于 2019-12-31 17:16:50
问题 I am writing an application in C++ with QT where you have n points and compute the convex hull of this. However, once this is computed I have no idea how to plot the points and draw the border of the hull. Making menu buttons and such is simple enough, but I'm not sure I know the tools to do this. How do you do this? 回答1: You can just create a custom class deriving from QWidget where you override the void paintEvent(QPaintEvent* event) method. In that you put the points into some sort of

How do you plot points in QT?

戏子无情 提交于 2019-12-31 17:14:03
问题 I am writing an application in C++ with QT where you have n points and compute the convex hull of this. However, once this is computed I have no idea how to plot the points and draw the border of the hull. Making menu buttons and such is simple enough, but I'm not sure I know the tools to do this. How do you do this? 回答1: You can just create a custom class deriving from QWidget where you override the void paintEvent(QPaintEvent* event) method. In that you put the points into some sort of

Using Qt Creator C++ 11, nullptr is keyworded?

早过忘川 提交于 2019-12-31 09:48:06
问题 I'm using C++11 using Qt Creator. "warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]" "error: 'nullptr' was not declared in this scope" This is on code that works elsewhere, the relevant part being: ... = nullptr; What might be the problem? Is this not already a keyword, isn't it's scope global? 回答1: Open your .pro file from inside QtCreator and add this QMAKE_CXXFLAGS += -std=c++0x 来源: https://stackoverflow.com/questions/16509932/using-qt-creator-c-11-nullptr-is-keyworded

QXcbConnection: Could not connect to display, when trying to debug Linux app with Qt Creator

别等时光非礼了梦想. 提交于 2019-12-31 04:02:09
问题 I am trying to port a set of Windows applications that were built with Qt Creator to Linux. I have installed Qt Creator 4.0.2 based on Qt 5.7.0 in a 64-bit Ubuntu 16.04 virtual machine using VirtualBox. The host PC is 64-bit Windows 7 Professional. I have successfully built one of the application projects and I am now trying to debug it. If I try to start debugging with F5, Qt insists on trying to compile one of the projects that does not yet compile so I am using "Start and Debug External

Cant use shared libraries in Qt project

南笙酒味 提交于 2019-12-30 22:45:07
问题 I created a C++ library project in Qt creator. After building the project I have the libMylib.so, .so.1, .so.1.0, .so.1.0.0, Makefile and mylib.o files. I added the library headers to my other project and added the path to my .pro file like this: LIBS += "/home/peter/Workspace/build-Libtester-Desktop-Release/libMyLib.so" When building the application I don't get no such file error, but when running it I get this: /home/peter/Workspace/build-Libtester-Desktop-Debug/Libtester: error while

Unable to compile QT Create Quick Application Project

雨燕双飞 提交于 2019-12-30 17:23:12
问题 I am new to QT Creator and I have installed QT Creator 5.6.2 with MinGW 4.9.2 32bit. I have a problem compiling a quick application project as it always shows this error message: Could not create directory "C:\Users\Hello\Documents\Error in " Util.asciify("build-untitled-Desktop_Qt_5_6_2_MinGW_32bit-Debug")": TypeError: Property 'asciify' of object Core::Internal::UtilsJsExtension(0xb05718) is not a function" Error while building/deploying project untitled (kit: Desktop Qt 5.6.2 MinGW 32bit)