Qt Creator: add Qt module to project
Edit your .pro file. It should has one line like this:
QT += core gui
Append the desired modules in this line. To get the module's names, just remove the "Qt" part in this list. (e.g. QtSql turns "sql")
How to install a missing Qt module?
Can I just download and install the missing module or do I have to
reinstall Qt with the missing module selected?
You don't have to reinstall Qt. You can just use Qt Maintenance tool to to add components and to update or remove installed components.
- Launch Qt Maintenance Tool and choose Add or remove components.
- Add a tick to the Qt Charts component in your currently installed version of Qt.
- Click the update button and wait for the process to complete.
QtCreator Custom Module Issue
I fixed the issue by dropping the source string from the .metainfo files.
For anyone that cares I was following these instructions:
http://doc.qt.io/qtcreator/creator-qml-modules-with-plugins.html
and on step 5 I picked a random metainfo file when I searched the Qt folder for .metainfo, not the one they specifically chose (qtcharts.metainfo vs qtquickcontrols2.metainfo)
The qtcharts one was probably for some other type of module use where specifying the source does something I don't need, the qtquickcontrols2 ended up having the syntax I really wanted in the end. Eventually I found this example and found out dropping the source worked:
https://forum.qt.io/topic/56207/how-to-load-custom-qml-controls-into-the-qml-designer
Qt Creator adding mqtt library
According to this, there's no need to add libraries, since MQTT is a Qt module just add this line in your pro file:
QT += mqtt
To use a Qt module, it must be installed in the Qt lib directory.
First, retrieve the lib directory path executing this command from a terminal:
qmake -query QT_INSTALL_LIBS
Cd into that directory and check if a file called Qt5Mqtt.dll is there: if not, you must build/install the module.
To get the module source code, you can execute this git command:
git clone git://code.qt.io/qt/qtmqtt.git
Once you have the source files, cd into the source files directory containing the file qtmqtt.pro and run these commands:
qmake
make
make install
(you may need administrator privileges for the last one).
After the commands completed successfully, you should be able to see the library in the QT_INSTALL_LIBS directory, and use the module in a Qt project.
In case of compilation issues, open the qtmqtt.pro file with creator, and try to build the library from there, then manually install (copy) it into the QT_INSTALL_LIBS.
can't include Qt classes while creating project with VS-add in
In addition @drescherjm comment, you should also check that you have an system environment variable set - The variable name should be QTDIR and the path should be the path of your installation - on my system this is C:\Qt\Qt5.5.1\5.5\msvc2013.
Related Topics
If I Have a Process, and I Clone It, Is the Pid the Same
How to Use Stdin Twice from Pipe
Undefined Reference to 'Dlopen'
How to Loop Through the Coming Frequency of the Keyword
Error: Can't Open Display: (Null) When Using Xclip to Copy Ssh Public Key
How to Get My Golang Web Server to Run in the Background
Automating Amazon Ebs Snapshots Anyone Have a Good Script or Solution for This on Linux
Mongodb Service Not Running in Fedora
Use Bash to Read a File and Then Execute a Command from the Words Extracted
How to Link to Shared Lib from Shared Lib with Relative Path
Different Results Between Ps Aux and 'Ps Aux' Inside a Script
How to Use Global Arrays in Bash
Crontab Is Not Working on Amazon Ec2 Server
Automatic Login on Angstrom Linux
How to Run Multiple Tor Processes at Once with Different Exit Ips
Macros for Gcc/G++ to Differentiate Linux and MAC Osx