Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget"
Forum Updated to NodeBB v4.3 + New Features

QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget"

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 4 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dheerendraD dheerendra

    Strange. Can u just create qpushbutton object & see it works ? Comment ur treebrowser code.

    jronaldJ Offline
    jronaldJ Offline
    jronald
    wrote on last edited by
    #9

    @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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #10

      Hi,

      Do you have any static QWiget object ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      jronaldJ 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Do you have any static QWiget object ?

        jronaldJ Offline
        jronaldJ Offline
        jronald
        wrote on last edited by
        #11

        @SGaist said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":

        Do you have any static QWiget object ?

        no

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #12

          If possible can you share your project bat pastebin or somewhere else ?

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          jronaldJ 1 Reply Last reply
          0
          • Maaz MominM Offline
            Maaz MominM Offline
            Maaz Momin
            wrote on last edited by
            #13

            @jronald I hope in the constructor definition you are passing the parameter to QApplication.

            MyApp (int &argc, char **argv) : QApplication(argc, argv)
            {
            ...
            }

            jronaldJ 1 Reply Last reply
            0
            • dheerendraD dheerendra

              If possible can you share your project bat pastebin or somewhere else ?

              jronaldJ Offline
              jronaldJ Offline
              jronald
              wrote on last edited by
              #14

              @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 ?

              1. create a new Qt Widget Application
              2. modify .pro to add INCLUDEPATH and LIBS for QtPropertyBrowser
              3. 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

              1 Reply Last reply
              0
              • Maaz MominM Maaz Momin

                @jronald I hope in the constructor definition you are passing the parameter to QApplication.

                MyApp (int &argc, char **argv) : QApplication(argc, argv)
                {
                ...
                }

                jronaldJ Offline
                jronaldJ Offline
                jronald
                wrote on last edited by
                #15

                @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

                1 Reply Last reply
                0
                • Maaz MominM Offline
                  Maaz MominM Offline
                  Maaz Momin
                  wrote on last edited by
                  #16

                  @jronald Can you paste your MyApp.h and MyApp.cpp here. Also If possible your .pro file.

                  jronaldJ 1 Reply Last reply
                  0
                  • Maaz MominM Maaz Momin

                    @jronald Can you paste your MyApp.h and MyApp.cpp here. Also If possible your .pro file.

                    jronaldJ Offline
                    jronaldJ Offline
                    jronald
                    wrote on last edited by
                    #17

                    @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.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #18

                      @jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":

                      QtTreePropertyBrowser

                      Where did you get that class from ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      jronaldJ 2 Replies Last reply
                      1
                      • SGaistS SGaist

                        @jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":

                        QtTreePropertyBrowser

                        Where did you get that class from ?

                        jronaldJ Offline
                        jronaldJ Offline
                        jronald
                        wrote on last edited by
                        #19

                        @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

                        1 Reply Last reply
                        0
                        • SGaistS SGaist

                          @jronald said in QtTreePropertyBrowser runtime error: "QWidget: Must construct a QApplication before a QWidget":

                          QtTreePropertyBrowser

                          Where did you get that class from ?

                          jronaldJ Offline
                          jronaldJ Offline
                          jronald
                          wrote on last edited by jronald
                          #20

                          @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 much

                          2 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
                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved