I have received a demo Qt project for a product.
I am trying to build the project and run it.
I am getting such a kind of error in Qt Designer when I try to build the project.
It says ui_FOO.h does not exist.
I see that FOO.ui (the qt designer form exists) but source and header files for it do not exist. And thats why i am getting the error.
What should I do to be able to build and run my project?
Add the following line to the pro file to get uic generate the C++ header from the ui file:
FORMS = FOO.ui
and build your project again.
You can find more information from Using a Designer UI File in Your Application.
Oh I got it.
This is a qt4 project as it is written in manual.
I went under tools->options->build&run->qtversions and added qmake-qt4
Then under the kit manually added a kit which uses the qtversion that i just specified.
Then under projects tile clicked on add kit and the kit appeared.
I removed the qt5 kit.
Now those ui_foo.h file is generated in its corresponding build path.
Related
i have built an QT GUI app using Visual Studio 2017 with Qt VS Tools extension and QT version 5.6 (the one provided by QT precompiled), using Qled widget plugin.
With this Default Dynamic Qt version, the app runs fine with the widget and i have no problems.
But now, i want to build the same app, but static, for use without dependencies.
So, i built QT 5.6 from source with -static parameter, to be more exact i follow this blog's guide. Here problems started to show up:
I tried to rebuild the widget plugin using the static qmake, but i got this error: "Project ERROR: Unknown module(s) in QT: designer"
I tried to use the plugin compiled by the dynamic qmake, and surprisingly, it built with success but the GUI app didn't open at all.
Its worth mentioning that i can use and build a simple default application using a qmake static build.
I think i need to add the Qt Designer Module, but i don't know how to do this, i even tried to rebuild qmake without the "-nomake tools" paramter, but got the same error building the plugin.
just don't build the plugin, you don't need it. Just add the qrc file, and the actual widget *.cpp and *.h file into your project
fix the linkage, delete the QDESIGNER_WIDGET_EXPORT in the *.h file inside your project
This comment managed to solved my problem, thanks to #PeterT
I have a makefile C/C++ project which multiple people are working on. I want to use Qt as an IDE because I really like the ease of autocompletion and links to declarations etc. However, it seems that I can't just open a working directly in Qt - I have to import or create a new project.
When creating a new project by importing an existing project, Qt creates several files (I do not want this), and when a new .c file or whatever is created outside Qt it is not shown in Qt.
Does someone have a solution to this?
You have to import your project as you are already doing.
You can ignore the files created by Qt Creator in your .gitignore file. Here's a nice repo for the templates: https://github.com/github/gitignore
Whenever you add a new file, you can add those using Add Existing files... option by right clicking on the project name.
I am interested to import Itk-snap source code in Qt5.4. Based on their help I could built the executable itksnap in my system using cmake(3.4.1). Then, I have imported the Cmakelist.txt in Qt creator and pressed "run camke". It is configured successfully, but I cannot see the project file ( no main.cpp or any file in left panel)! , cannot build it because it does not loaded in Qt creator.
What do I do wrong? How can I have itksnap in my QT creator.
I am using OSX, and unix generator for camke.
As I can understand you are trying to build cmake project using QtCreator as an IDE, if so have a look here http://doc.qt.io/qtcreator/creator-project-cmake.html
Finally, I could find out what was wrong. For whoever is interested and have same problem like me, I recommend to do : first to build binary of itk-snap source file using Cmake-Gui and build based on their help to the different folder. After you are sure that you can make the binary file, goes to the Qt-Creator, change the Kit and other setting if its not correct, then open Cmakelist.txt from source of itk-snap. It shows a windows to run the cmake inside the QT-creator. Go back to your Cmake-Gui and from Tools >> show my changes menu, copy the argument and past to the argument textBox in QT. In my case variables are
-DVTK_REQUIRED_OBJCXX_FLAGS:STRING="" -DSNAP_USE_GPU:BOOL="1" -DVTK_DIR:PATH="/Users/../itkSnap3/vtk/build" -DITK_DIR:PATH="/Users/../itkSnap3/itk/build" -DCMAKE_PREFIX_PATH:PATH="/usr/local/Cellar/qt5/5.5.1_2/lib/cmake"
Good luck
So I have a simple app that uses QML for my graphical interface and c++ code for some of the logic. I was looking for a method to compile the QML into c++ code and link it into my binary and found this page over at the Qt home site:
http://doc.qt.io/QtQuickCompiler/
Basically it says use the resource system for all of my QML graphical interface files and add the QML compiler flag to my qmake config line in my .pro file and everything should be good to go.
As far as I know everything compiles fine, but when I use the the Qt windeployqt.exe tool to get all of the dependency files and test it on a clean system, I get a small white screen as if my QML files were not loaded properly.
I have one c++ reference to my main QML file using "qrc:/mainqml.qml" and that's it.
Any idea what I am doing wrong?
You're using the open source version of Qt. It didn't come with the Qt Quick compiler until Qt 5.11 where it is included - and after a rework, too. So it performs better than precompiled QML did in Qt 5.10 and before.
I get a small white screen as if my QML files were not loaded properly.
... thus you need to deploy these files with the application, otherwise it won't work.
add the QML compiler flag to my qmake config
That flag was a no-op on an open source Qt build until Qt 5.11.
Qt Quick Compiler only shipped with Qt Commercial License, but you can still compile your QML files into qrc file. Starting a Qt Quick application project from Qt Creator does exactly this.
Deploying QML application with windeployqt require additional flag --qmldir, e.g.
windeployqt --(release or debug) --qmldir %PATH_TO_YOUR_QML_FILES% %YOUR_APPLICATION%.exe
It will parse your qml files and deploy all qml imports you used.
Preface: I am using Qt Creator 2.4.1 (based on Qt 4.7.4, 64-bit) on Mac OS X Lion installed via the Qt SDK.
I am working on a project where I have a UI created using the designer in QCreator. I have several widgets working without issue. I created a new QPushButton widget by dragging it from the desiger palette and set some properties in the designer. However, I am unable to access it from the source code using the ui->[widget] convention. I can access every other widget on the form as expected. A search of the site yielded one similar issue, however the solution specified does not work for me.
I've tried:
Clean, full rebuild
Re-running qmake
Restarting QCreator
I have checked the ui element's generated XML and the widget is included and with the correct objectName and properties, yet the source code portion of the designer does not see it.
I solved this issue by deleting the current working directory, checking out the latest source from version control, and creating a new project. After further scrutiny, I found that ui_mainwindow.h, which is generated every compile by qmake, had been moved into the source directory instead of the build directory, which must have caused some internal conflict with QCreator where it would not regenerate it and just copy the old one to the build folder. Deleting the file probably would have worked if I had seen it and saved me the time of starting fresh.