Merge QDialog project into a QWindow project
Solved
General and Desktop
-
I have two separate projects, one is a QDialog and another is a QWindow.
I would like to integrate the QDialog into the QWindow project.
My QDialog .pro file contains this:
QT += core gui QT += serialport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ dialog.cpp HEADERS += \ dialog.h \ FORMS += \ dialog.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
I won't copy the QWindow.pro file because is very long, but can tell you that:
- It doesn't contain the QT += core gui QT += serialport lines that the QDialog has
- It doesn't contain any Forms
How can merge the QDialog into the QWindow project?
-
Hi
You can just add
dialog.cpp
dialog.h
dialog.uiTo your QWindow project and simply
create an instance of the dialog and show it.Copy the files first to the QWindow project folder
then right click in Creator and use the Add existing files.
Then select the files.
Since dialog project use
QT += serialportyou might want to add that to the project file if it does need qserialport class.