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. form on create function
Qt 6.11 is out! See what's new in the release blog

form on create function

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 4 Posters 3.8k Views 3 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.
  • F freevrs

    @jsulm

    i got a sigsegv

    it is segfaulting at the wizard() in the constructor

    But i dont get why, because i call it the same way later on (in the click funktions) and everything is fine

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @freevrs As far as I can see wizard() returns a pointer. Is it possible that it returns an invalid pointer? And does it crash inside wizard()?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    F 1 Reply Last reply
    0
    • jsulmJ jsulm

      @freevrs As far as I can see wizard() returns a pointer. Is it possible that it returns an invalid pointer? And does it crash inside wizard()?

      F Offline
      F Offline
      freevrs
      wrote on last edited by
      #7

      @jsulm

      this is the complete stack trace

      Thread 1 (Thread 9460.0x2030):
      #0  0x0accbeac in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data (this=0x4) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:135
      No locals.
      #1  0x0aae7e74 in qGetPtrHelper<QScopedPointer<QObjectData> > (p=...) at ../../include/QtCore/../../src/corelib/global/qglobal.h:983
      No locals.
      #2  0x0acf8d57 in QWizard::d_func (this=0x0) at dialogs/qwizard.h:193
      No locals.
      #3  0x0aae5b9f in QWizard::button (this=0x0, which=QWizard::NextButton) at dialogs\qwizard.cpp:2818
              d = 0x15b6de38
      #4  0x00401df8 in WizardPage2::WizardPage2 (this=0x15b6dc78, parent=0x0) at ..\SPAPP-Screen\wizardpage2.cpp:10
      No locals.
      #5  0x00401711 in qMain (argc=1, argv=0x9c3578) at ..\SPAPP-Screen\main.cpp:26
              a = {<QGuiApplication> = {<QCoreApplication> = {<QObject> = {_vptr.QObject = 0xadf7f88 <vtable for QApplication+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x9c3628}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0x6bc47600 <qt_meta_stringdata_QCoreApplication>, data = 0x6bc477c0 <qt_meta_data_QCoreApplication>, static_metacall = 0x6b9693e4 <QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, static self = 0x28fe3c}, static staticMetaObject = {d = {superdata = 0x6bc47584 <QCoreApplication::staticMetaObject>, stringdata = 0xf7ee00 <qt_meta_stringdata_QGuiApplication>, data = 0xf7f200 <qt_meta_data_QGuiApplication>, static_metacall = 0xb4e2bc <QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xf75040 <QGuiApplication::staticMetaObject>, stringdata = 0xad1f4c0 <qt_meta_stringdata_QApplication>, data = 0xad1f740 <qt_meta_data_QApplication>, static_metacall = 0xa8c1134 <QApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
              w = {<QMainWindow> = {<QWidget> = {<QObject> = {_vptr.QObject = 0x40cfc8 <vtable for MainWindow+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x9cdf78}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0x40d0a4 <vtable for MainWindow+228>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0xad25b40 <qt_meta_stringdata_QWidget>, data = 0xad265c0 <qt_meta_data_QWidget>, static_metacall = 0xa8fc0ec <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x9ce020}, static staticMetaObject = {d = {superdata = 0xad1c060 <QWidget::staticMetaObject>, stringdata = 0xade7280 <qt_meta_stringdata_QMainWindow>, data = 0xade75c0 <qt_meta_data_QMainWindow>, static_metacall = 0xabf8e1c <QMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0xade776c <qt_meta_extradata_QMainWindow>, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xade7218 <QMainWindow::staticMetaObject>, stringdata = 0x40c4c4 <qt_meta_stringdata_MainWindow>, data = 0x40c4e0 <qt_meta_data_MainWindow>, static_metacall = 0x402220 <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x9ceb50}
              setupcomplete = false
              wizard = {<QDialog> = {<QWidget> = {<QObject> = {_vptr.QObject = 0xae074c8 <vtable for QWizard+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x15b52298}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0xae075c4 <vtable for QWizard+260>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0xad25b40 <qt_meta_stringdata_QWidget>, data = 0xad265c0 <qt_meta_data_QWidget>, static_metacall = 0xa8fc0ec <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x15b52340}, static staticMetaObject = {d = {superdata = 0xad1c060 <QWidget::staticMetaObject>, stringdata = 0xad5b0c0 <qt_meta_stringdata_QDialog>, data = 0xad5b240 <qt_meta_data_QDialog>, static_metacall = 0xaab1464 <QDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xad5afcc <QDialog::staticMetaObject>, stringdata = 0xad64a80 <qt_meta_stringdata_QWizard>, data = 0xad65040 <qt_meta_data_QWizard>, static_metacall = 0xaae748c <QWizard::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
      #6  0x00403b50 in WinMain@16 () at qtmain_win.cpp:113
              argc = 1
              argvW = 0xa3c200
              argv = 0x9c3578
              exitCode = 119
      #7  0x004066ed in main ()
      No symbol table info available.
      

      is it maby that because the wizard is created in the main.cpp

      QWizard wizard;
          wizard.setWindowTitle("Setup");
          wizard.addPage(new WizardPage1());
          wizard.addPage(new WizardPage2());
          wizard.addPage(new WizardPage3());
          wizard.show();
      

      and the wizardpacge2 is compiled before that , that wthe wizard() does not exist at this moment ?

      jsulmJ 2 Replies Last reply
      0
      • F freevrs

        @jsulm

        this is the complete stack trace

        Thread 1 (Thread 9460.0x2030):
        #0  0x0accbeac in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data (this=0x4) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:135
        No locals.
        #1  0x0aae7e74 in qGetPtrHelper<QScopedPointer<QObjectData> > (p=...) at ../../include/QtCore/../../src/corelib/global/qglobal.h:983
        No locals.
        #2  0x0acf8d57 in QWizard::d_func (this=0x0) at dialogs/qwizard.h:193
        No locals.
        #3  0x0aae5b9f in QWizard::button (this=0x0, which=QWizard::NextButton) at dialogs\qwizard.cpp:2818
                d = 0x15b6de38
        #4  0x00401df8 in WizardPage2::WizardPage2 (this=0x15b6dc78, parent=0x0) at ..\SPAPP-Screen\wizardpage2.cpp:10
        No locals.
        #5  0x00401711 in qMain (argc=1, argv=0x9c3578) at ..\SPAPP-Screen\main.cpp:26
                a = {<QGuiApplication> = {<QCoreApplication> = {<QObject> = {_vptr.QObject = 0xadf7f88 <vtable for QApplication+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x9c3628}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0x6bc47600 <qt_meta_stringdata_QCoreApplication>, data = 0x6bc477c0 <qt_meta_data_QCoreApplication>, static_metacall = 0x6b9693e4 <QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, static self = 0x28fe3c}, static staticMetaObject = {d = {superdata = 0x6bc47584 <QCoreApplication::staticMetaObject>, stringdata = 0xf7ee00 <qt_meta_stringdata_QGuiApplication>, data = 0xf7f200 <qt_meta_data_QGuiApplication>, static_metacall = 0xb4e2bc <QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xf75040 <QGuiApplication::staticMetaObject>, stringdata = 0xad1f4c0 <qt_meta_stringdata_QApplication>, data = 0xad1f740 <qt_meta_data_QApplication>, static_metacall = 0xa8c1134 <QApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
                w = {<QMainWindow> = {<QWidget> = {<QObject> = {_vptr.QObject = 0x40cfc8 <vtable for MainWindow+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x9cdf78}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0x40d0a4 <vtable for MainWindow+228>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0xad25b40 <qt_meta_stringdata_QWidget>, data = 0xad265c0 <qt_meta_data_QWidget>, static_metacall = 0xa8fc0ec <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x9ce020}, static staticMetaObject = {d = {superdata = 0xad1c060 <QWidget::staticMetaObject>, stringdata = 0xade7280 <qt_meta_stringdata_QMainWindow>, data = 0xade75c0 <qt_meta_data_QMainWindow>, static_metacall = 0xabf8e1c <QMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0xade776c <qt_meta_extradata_QMainWindow>, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xade7218 <QMainWindow::staticMetaObject>, stringdata = 0x40c4c4 <qt_meta_stringdata_MainWindow>, data = 0x40c4e0 <qt_meta_data_MainWindow>, static_metacall = 0x402220 <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x9ceb50}
                setupcomplete = false
                wizard = {<QDialog> = {<QWidget> = {<QObject> = {_vptr.QObject = 0xae074c8 <vtable for QWizard+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x15b52298}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0xae075c4 <vtable for QWizard+260>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0xad25b40 <qt_meta_stringdata_QWidget>, data = 0xad265c0 <qt_meta_data_QWidget>, static_metacall = 0xa8fc0ec <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x15b52340}, static staticMetaObject = {d = {superdata = 0xad1c060 <QWidget::staticMetaObject>, stringdata = 0xad5b0c0 <qt_meta_stringdata_QDialog>, data = 0xad5b240 <qt_meta_data_QDialog>, static_metacall = 0xaab1464 <QDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xad5afcc <QDialog::staticMetaObject>, stringdata = 0xad64a80 <qt_meta_stringdata_QWizard>, data = 0xad65040 <qt_meta_data_QWizard>, static_metacall = 0xaae748c <QWizard::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
        #6  0x00403b50 in WinMain@16 () at qtmain_win.cpp:113
                argc = 1
                argvW = 0xa3c200
                argv = 0x9c3578
                exitCode = 119
        #7  0x004066ed in main ()
        No symbol table info available.
        

        is it maby that because the wizard is created in the main.cpp

        QWizard wizard;
            wizard.setWindowTitle("Setup");
            wizard.addPage(new WizardPage1());
            wizard.addPage(new WizardPage2());
            wizard.addPage(new WizardPage3());
            wizard.show();
        

        and the wizardpacge2 is compiled before that , that wthe wizard() does not exist at this moment ?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @freevrs

        #3  0x0aae5b9f in QWizard::button (this=0x0, which=QWizard::NextButton) at dialogs\qwizard.cpp:2818
                d = 0x15b6de38
        #4  0x00401df8 in WizardPage2::WizardPage2 (this=0x15b6dc78, parent=0x0) at ..\SPAPP-Screen\wizardpage2.cpp:10
        No locals.
        

        Can you show the code in wizardpage2.cpp around the line 10?
        In this line I can see that this is null:

        #3  0x0aae5b9f in QWizard::button (this=0x0, which=QWizard::NextButton) at dialogs\qwizard.cpp:2818
                d = 0x15b6de38
        

        And can you please explain what wizard() is doing? Wizard itself already exists when you create WizardPage2.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • F freevrs

          @jsulm

          this is the complete stack trace

          Thread 1 (Thread 9460.0x2030):
          #0  0x0accbeac in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data (this=0x4) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:135
          No locals.
          #1  0x0aae7e74 in qGetPtrHelper<QScopedPointer<QObjectData> > (p=...) at ../../include/QtCore/../../src/corelib/global/qglobal.h:983
          No locals.
          #2  0x0acf8d57 in QWizard::d_func (this=0x0) at dialogs/qwizard.h:193
          No locals.
          #3  0x0aae5b9f in QWizard::button (this=0x0, which=QWizard::NextButton) at dialogs\qwizard.cpp:2818
                  d = 0x15b6de38
          #4  0x00401df8 in WizardPage2::WizardPage2 (this=0x15b6dc78, parent=0x0) at ..\SPAPP-Screen\wizardpage2.cpp:10
          No locals.
          #5  0x00401711 in qMain (argc=1, argv=0x9c3578) at ..\SPAPP-Screen\main.cpp:26
                  a = {<QGuiApplication> = {<QCoreApplication> = {<QObject> = {_vptr.QObject = 0xadf7f88 <vtable for QApplication+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x9c3628}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0x6bc47600 <qt_meta_stringdata_QCoreApplication>, data = 0x6bc477c0 <qt_meta_data_QCoreApplication>, static_metacall = 0x6b9693e4 <QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, static self = 0x28fe3c}, static staticMetaObject = {d = {superdata = 0x6bc47584 <QCoreApplication::staticMetaObject>, stringdata = 0xf7ee00 <qt_meta_stringdata_QGuiApplication>, data = 0xf7f200 <qt_meta_data_QGuiApplication>, static_metacall = 0xb4e2bc <QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xf75040 <QGuiApplication::staticMetaObject>, stringdata = 0xad1f4c0 <qt_meta_stringdata_QApplication>, data = 0xad1f740 <qt_meta_data_QApplication>, static_metacall = 0xa8c1134 <QApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
                  w = {<QMainWindow> = {<QWidget> = {<QObject> = {_vptr.QObject = 0x40cfc8 <vtable for MainWindow+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x9cdf78}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0x40d0a4 <vtable for MainWindow+228>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0xad25b40 <qt_meta_stringdata_QWidget>, data = 0xad265c0 <qt_meta_data_QWidget>, static_metacall = 0xa8fc0ec <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x9ce020}, static staticMetaObject = {d = {superdata = 0xad1c060 <QWidget::staticMetaObject>, stringdata = 0xade7280 <qt_meta_stringdata_QMainWindow>, data = 0xade75c0 <qt_meta_data_QMainWindow>, static_metacall = 0xabf8e1c <QMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0xade776c <qt_meta_extradata_QMainWindow>, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xade7218 <QMainWindow::staticMetaObject>, stringdata = 0x40c4c4 <qt_meta_stringdata_MainWindow>, data = 0x40c4e0 <qt_meta_data_MainWindow>, static_metacall = 0x402220 <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x9ceb50}
                  setupcomplete = false
                  wizard = {<QDialog> = {<QWidget> = {<QObject> = {_vptr.QObject = 0xae074c8 <vtable for QWizard+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bb73880 <qt_meta_stringdata_QObject>, data = 0x6bb73980 <qt_meta_data_QObject>, static_metacall = 0x6b90941e <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x15b52298}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6bc32900 <qt_meta_stringdata_Qt>, data = 0x6bc3b040 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0xae075c4 <vtable for QWizard+260>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bb7340c <QObject::staticMetaObject>, stringdata = 0xad25b40 <qt_meta_stringdata_QWidget>, data = 0xad265c0 <qt_meta_data_QWidget>, static_metacall = 0xa8fc0ec <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x15b52340}, static staticMetaObject = {d = {superdata = 0xad1c060 <QWidget::staticMetaObject>, stringdata = 0xad5b0c0 <qt_meta_stringdata_QDialog>, data = 0xad5b240 <qt_meta_data_QDialog>, static_metacall = 0xaab1464 <QDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xad5afcc <QDialog::staticMetaObject>, stringdata = 0xad64a80 <qt_meta_stringdata_QWizard>, data = 0xad65040 <qt_meta_data_QWizard>, static_metacall = 0xaae748c <QWizard::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
          #6  0x00403b50 in WinMain@16 () at qtmain_win.cpp:113
                  argc = 1
                  argvW = 0xa3c200
                  argv = 0x9c3578
                  exitCode = 119
          #7  0x004066ed in main ()
          No symbol table info available.
          

          is it maby that because the wizard is created in the main.cpp

          QWizard wizard;
              wizard.setWindowTitle("Setup");
              wizard.addPage(new WizardPage1());
              wizard.addPage(new WizardPage2());
              wizard.addPage(new WizardPage3());
              wizard.show();
          

          and the wizardpacge2 is compiled before that , that wthe wizard() does not exist at this moment ?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #9

          @freevrs "and the wizardpacge2 is compiled before that , that wthe wizard() does not exist at this moment" I don't understand this sentence.
          First, wizardpacge2 is not compiled - it is instantiated/created.
          Second, "wizard() does not exist at this moment" - wizard() is a method, so it exists.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          F 1 Reply Last reply
          0
          • jsulmJ jsulm

            @freevrs "and the wizardpacge2 is compiled before that , that wthe wizard() does not exist at this moment" I don't understand this sentence.
            First, wizardpacge2 is not compiled - it is instantiated/created.
            Second, "wizard() does not exist at this moment" - wizard() is a method, so it exists.

            F Offline
            F Offline
            freevrs
            wrote on last edited by freevrs
            #10

            @jsulm

            wizard() is a method i can use after the wizardpage is created.

            with that i can access elements of the wizard box (like buttons)

            the wizard is created in the main function and than the wizard pages get added.

            so i dont understand why i cant use it in the creator

            http://doc.qt.io/qt-4.8/qwizard.html
            http://doc.qt.io/qt-5/qwizardpage.html
            http://www.qtcentre.org/threads/13844-How-to-disable-NextButton-in-QWizard

            jsulmJ 1 Reply Last reply
            0
            • F freevrs

              @jsulm

              wizard() is a method i can use after the wizardpage is created.

              with that i can access elements of the wizard box (like buttons)

              the wizard is created in the main function and than the wizard pages get added.

              so i dont understand why i cant use it in the creator

              http://doc.qt.io/qt-4.8/qwizard.html
              http://doc.qt.io/qt-5/qwizardpage.html
              http://www.qtcentre.org/threads/13844-How-to-disable-NextButton-in-QWizard

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #11

              @freevrs Please read the documentation (http://doc.qt.io/qt-5/qwizardpage.html#wizard):

              Returns the wizard associated with this page, or 0 if this page hasn't been inserted into a QWizard yet.
              
              QWizard wizard;
              wizard.addPage(new WizardPage2());
              

              new WizardPage2() creates a new instance and calls its constructor - at that time the wizard is not yet set, it is set when wizard.addPage(...) is called which happens after the constructor was executed. That's why wizard() returns a null pointer in constructor.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              F 1 Reply Last reply
              1
              • jsulmJ jsulm

                @freevrs Please read the documentation (http://doc.qt.io/qt-5/qwizardpage.html#wizard):

                Returns the wizard associated with this page, or 0 if this page hasn't been inserted into a QWizard yet.
                
                QWizard wizard;
                wizard.addPage(new WizardPage2());
                

                new WizardPage2() creates a new instance and calls its constructor - at that time the wizard is not yet set, it is set when wizard.addPage(...) is called which happens after the constructor was executed. That's why wizard() returns a null pointer in constructor.

                F Offline
                F Offline
                freevrs
                wrote on last edited by
                #12

                @jsulm

                ok .. but how can i solve this ?

                can i create a slot that is called on the addPage event an then call wizard() ?
                Or do you have a better idea / solution for that.

                What i need to achive is, that when the wizzard page is shown the next button is disabled

                jsulmJ kshegunovK 2 Replies Last reply
                0
                • F freevrs

                  @jsulm

                  ok .. but how can i solve this ?

                  can i create a slot that is called on the addPage event an then call wizard() ?
                  Or do you have a better idea / solution for that.

                  What i need to achive is, that when the wizzard page is shown the next button is disabled

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  @freevrs You can overwrite http://doc.qt.io/qt-5/qwidget.html#showEvent

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • F freevrs

                    @jsulm

                    ok .. but how can i solve this ?

                    can i create a slot that is called on the addPage event an then call wizard() ?
                    Or do you have a better idea / solution for that.

                    What i need to achive is, that when the wizzard page is shown the next button is disabled

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by kshegunov
                    #14

                    @freevrs

                    You can intercept the widget parent's swap by handling the QEvent::ParentChange. Also you can queue the initialization for later when control returns to the event loop, which would by my preference, e.g.:

                    class WizardPage2
                    {
                    public:
                        WizardPage2(QWidget * parent);
                    
                    private:
                         Q_INVOKABLE void initMyPage();
                    };
                    
                    WizardPage2::WizardPage2(QWidget * parent)
                        : QWizardPage(parent)
                    {
                        QMetaObject::invokeMethod(this, "initMyPage", Qt::QueuedConnection);
                    }
                    
                    void WizardPage2::initMyPage()
                    {
                        // wizard() should be pointing to an object now.
                    }
                    

                    Read and abide by the Qt Code of Conduct

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

                      Hi,

                      But why disable the wizard button in the constructor of the second page ? That's rather the role of the page validation. See QWizard::validateCurrentPage documentation.

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

                      1 Reply Last reply
                      0
                      • kshegunovK kshegunov

                        @freevrs

                        You can intercept the widget parent's swap by handling the QEvent::ParentChange. Also you can queue the initialization for later when control returns to the event loop, which would by my preference, e.g.:

                        class WizardPage2
                        {
                        public:
                            WizardPage2(QWidget * parent);
                        
                        private:
                             Q_INVOKABLE void initMyPage();
                        };
                        
                        WizardPage2::WizardPage2(QWidget * parent)
                            : QWizardPage(parent)
                        {
                            QMetaObject::invokeMethod(this, "initMyPage", Qt::QueuedConnection);
                        }
                        
                        void WizardPage2::initMyPage()
                        {
                            // wizard() should be pointing to an object now.
                        }
                        
                        F Offline
                        F Offline
                        freevrs
                        wrote on last edited by
                        #16

                        @kshegunov

                        Your solution works pretty good.

                        I implemented it on page2
                        but insted it is only setting the button on page 1 (not implemented there)
                        and not on page2

                        Do i need to use another event ?

                        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