QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget"
-
Strange. Can u just create qpushbutton object & see it works ? Comment ur treebrowser code.
@dheerendra said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
Strange. Can u just create qpushbutton object & see it works ? Comment ur treebrowser code.
everything else works
-
Hi,
Do you have any static QWiget object ?
-
If possible can you share your project bat pastebin or somewhere else ?
-
@jronald I hope in the constructor definition you are passing the parameter to QApplication.
MyApp (int &argc, char **argv) : QApplication(argc, argv)
{
...
} -
If possible can you share your project bat pastebin or somewhere else ?
@dheerendra said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
If possible can you share your project bat pastebin or somewhere else ?
- create a new
Qt Widget Application
- modify .pro to add
INCLUDEPATH
andLIBS
forQtPropertyBrowser
- edit
MainWindow.cpp
#include "MainWindow.h" #include "ui_MainWindow.h" #include <QtTreePropertyBrowser> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { QtTreePropertyBrowser * p = new QtTreePropertyBrowser(this); ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; }
Application Output Window shows:
QWidget: Must construct a QApplication before a QWidget
- create a new
-
@jronald I hope in the constructor definition you are passing the parameter to QApplication.
MyApp (int &argc, char **argv) : QApplication(argc, argv)
{
...
}@Maaz-Momin said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
@jronald I hope in the constructor definition you are passing the parameter to QApplication.
MyApp (int &argc, char **argv) : QApplication(argc, argv)
{
...
}sure, it's by default
-
@jronald Can you paste your MyApp.h and MyApp.cpp here. Also If possible your .pro file.
-
@jronald Can you paste your MyApp.h and MyApp.cpp here. Also If possible your .pro file.
@Maaz-Momin said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
@jronald Can you paste your MyApp.h and MyApp.cpp here. Also If possible your .pro file.
I've created a new
Qt Widget Application
for testing. -
@jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
QtTreePropertyBrowser
Where did you get that class from ?
-
@jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
QtTreePropertyBrowser
Where did you get that class from ?
@SGaist said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
Where did you get that class from ?
QtPropertyBrowser head at https://github.com/qtproject/qt-solutions.git
-
@jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
QtTreePropertyBrowser
Where did you get that class from ?
@SGaist said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
@jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":
QtTreePropertyBrowser
Where did you get that class from ?
Tried https://code.qt.io/qt-solutions/qt-solutions.git, to my surprise it works.
Thank you very much2 points to mention:
- debug/release must be matched for app and the lib
- clean before build (rebuild may be ok, not tried), or delete the build dir manully