I'm new to Qt, learning through a Qt Creator tutorial. I am trying to connect Qt with a MySQL database. To do so, I have to modify a .pro file adding the command QT += core sql
However, once I create a project there is no .pro file in the menu, only the .ccp file.
Program installed: Qt Creator 4.13.0
OS: Windows 10 x64
Steps followed:
Choose New Project
Choose Qt Console Application
Build system: CMake
Kits: I have some available; I am using Qt 5.15.1 MSVC2019 64bit
The menu displayed shows a CMakesList.txt file, and the main.ccp source file. However no .pro file is created.
For new build system you should modify CMakeList.txt file.
Please try to replace
target_link_libraries(myapp Qt5::Gui)
with
target_link_libraries(myapp Qt5::Gui Qt5::Sql)
Related
I am using FileDialog from Qt.labs.platform 1.1 on win 10 in Qt creator, compilator I use is Desktop Qt 5.15.2. MinGW 64 bit.
In the debug mode is working everthing fine but when I change to release mode I get following error in from the compilator:
QQmlApplicationEngine failed to load component
qrc:/main.qml:6:1: module "Qt.labs.platform" is not installed
I tried things like clean and rebuild or restart the computer and also change the number of import version but nothing helps. Any ideas how to solve that, please?
Check folder, where you are building your release (where *.exe is generated):
does it contains some Qt's *.dll's?
If yes: there is two ways to resolve your problem:
Remove all Qt *.dll's and run your application from Qt Creator (then Qt Creator will take all Qt *.dll's from folder, where Qt is installed).
Or add all needed Qt *.dll's with correct folder structure to folder with your release *.exe (to do it for Windows release use windeployqt tool: https://doc.qt.io/qt-6/windows-deployment.html )
Why you have such error from the compilator?
Because you have some Qt *.dll's in your release folder (beside the *.exe), but not all needed (e.g. you have only Qt6Core.dll). So Qt Creator will find this dll and will try to find other dll's in your release folder. Qt Creator will not check its installation directory to get dll's.
But if you have no Qt *.dll's in your release folder, then Qt Creator will find them in its installation directory.
I built the sources of Qt5.8 with the option ./configure -opengl desktop
Then, I did a make and finally sudo make install. Now I changed the .profile file as pointed here: http://doc.qt.io/qt-5/linux-building.html
But I have a question: How can I start now qt creator ide?
It seems you're looking for qt creator, which isn't bundled in the qt sources and must be compiled separately, however if you want qt creator alongside with your new qt build, download the qt creator alone and install it, after that open the qt creator, go to Settings -> Build & Run -> Qt Versions , from there you can add new qt versions, just point to qmake which is located in your new qt installation (Probably /usr/local/qt5/bin/qmake) , now add a new kit via Kit's tab and then you can use your newly installed qt with qt creator.
When I open a qt gui project in visual studio (through qt-addin and openning .pro file in vs), it does not open console for me while in .pro file I'd added this line :
CONFIG += console
and console comes up in qt creator, but my problem is when I open the pro file in visual studio!.
how can I open console inside my gui in visual studio after opening .pro file in it? (I use qt5 and vs2012)
After adding your new CONFIG line to the .pro file, run the following command line call in the MSVC command line window to regenerate your Visual Studio project to be one for a Qt console application:
qmake -tp vc foo.pro
The Windows environment variables QMAKESPEC and QTDIR need to be properly set, and also set PATH=%QTDIR%\bin;%PATH%
I have scoured the internet for information regarding the installation process for plugins into Qt Designer and I have found no helpful/relevant information.
The plugin I want to install is the echo plugin.
I have also looked through the Qt Designer program files and found the echoplugin folder but have no idea how to install it. Here is the file location:
C:\Qt\Examples\Qt-5.5\widgets\tools\echoplugin
This holds the following file types; Qt Project Files, C++ Header, C++ Source and JSON
System Information
Windows 10
PyQt4
Qt Designer 5.5.0
Official documentation describes it very well.
To install plugin for Qt Designer or Qt Creator you need to place the plugin to plugins\designer directory.
For Qt Creator it is located in it's bin directory.
Qt Designer is a part of Qt installation so directory will be QTDIR\plugins\designer where QTDIR is Qt installation path (for me it is "E:\DEV\Qt\5.5\msvc2015_desktop_shared" and full plugins path is "E:\DEV\Qt\5.5\msvc2015_desktop_shared\plugins\designer").
One important thing - Qt Designer / Qt Creator and the plugin must be compiled using the same compiler version. You can not install plugin compiled with MSVC 2015 to Qt Designer compiled with MSVC 2013!
Edit:
I am using C++ version of Qt.
It looks like echo plugin is not a plugin for Qt Designer / Qt Creator.
I'm trying to import my Cmake project in QtCreator, which I'd want to use as code editor, but with completition for Qt classes an the possibility to do the build via Ctrl+R
When importing the Cmake project, the QtCreator ide hangs when running CMakeWizard when I try to select RunCmake. If I cancel an empty windows pops up and the project is not generated.
Is it possible to import an existing cmake project in QtCreator?
Ubuntu 10.10 x86_64, QtCreator 2.6
Normally you just do "Open Project" and then select the CMakeLists.txt as the project file. QtCreator will then ask you to run CMake once (to generate a CodeBlocks build file, which is then interpreted by QtCreator). After that you have native support for your CMake project.
It even works with rather complicated CMake scripts.
If you observe hangs etc., you should probably file a bug report with the QtCreator project.
I had a similar issue when qtcreator crashed when opening cmake projects created in older versions of qtcreator. Removing CMakeLists.txt.user and running qt from terminal resolved issue for me.
cd /path/to/project/
qtcreator .