Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. HOw to display new windows
Forum Updated to NodeBB v4.3 + New Features

HOw to display new windows

Scheduled Pinned Locked Moved Mobile and Embedded
16 Posts 5 Posters 10.5k 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.
  • ZlatomirZ Offline
    ZlatomirZ Offline
    Zlatomir
    wrote on last edited by
    #4

    Well we can, but you won't really learn from that, i think it is more important that we explain stuff and you correct your code, do you agree with me?

    So, as i said in forum.nokia, the compilation problem is not with two forms, it's all about the forma class, which has undefined slots/member functions:

    I tried to explain, i will try to repeat the explanation, and please try to read and apply what we say.

    So in class froma.h you declare two slots:
    @private slots:
    void on_formbButton_clicked(); //this one is not defined in the forma.cpp file
    void on_unlockButton_clicked(); //this one is OK... it is defined in .cpp file and it close the first window
    @

    And it forma.cpp you have the following code, that is supposed to open the second form, but this name void forma:: on_iceButton_clicked() it is not declared so the C++ compiler can't recognize it

    So figure the name of the button that you want to open the second form and then use the same name for declaration and definition too.

    https://forum.qt.io/category/41/romanian

    1 Reply Last reply
    0
    • I Offline
      I Offline
      ifewalter
      wrote on last edited by
      #5

      now that has been corrected. same compilation error

      undefined reference to formb::formb(QWidget*)

      now maybe we address the mem. leak issue, could that be the cause?
      the the parent thing. can you give any hint?

      --Ifewalter--

      1 Reply Last reply
      0
      • ZlatomirZ Offline
        ZlatomirZ Offline
        Zlatomir
        wrote on last edited by
        #6

        formb class seems ok

        So try from the Build menu: Clean All, Run qmake then Rebuild

        Or manually delete the auto-generated files then rebuild.

        And you can give the parent too, like this:
        @
        void forma:: on_ButtonName_clicked()
        {
        formb *j = new formb(this); //the forma will be the parent of formb

        j->showMaximized();
        

        }
        @

        https://forum.qt.io/category/41/romanian

        1 Reply Last reply
        0
        • I Offline
          I Offline
          ifewalter
          wrote on last edited by
          #7

          you know funny thing is i've tried that parenting suggestion you justst gav, but it gave same error. I'll try the build thing again when i get home.

          Or maybe just reinstall qt. I the vode is seemingly ok.
          But that will be when i get home. I'm currently in transit from school.

          --Ifewalter--

          1 Reply Last reply
          0
          • ZlatomirZ Offline
            ZlatomirZ Offline
            Zlatomir
            wrote on last edited by
            #8

            You don't need to reinstall Qt, that won't solve the problem
            Also the parent isn't a solution for this compile error

            If you give a parent you will also need to tell Qt that you want formb to be a new window, this is because your formb inherits from QWidget and not from QMainWindow or QDialog.
            So complete code for slot is:
            @
            void forma:: on_ButtonName_clicked()
            {
            formb *j = new formb(this);
            j->setWindowFlags(Qt::Window); //this way you show your QWidget as a new window and pass a parent

            j->showMaximized();
            

            }
            @
            Put something inside formb and see without that line where it will appear

            https://forum.qt.io/category/41/romanian

            1 Reply Last reply
            0
            • I Offline
              I Offline
              ifewalter
              wrote on last edited by
              #9

              thank you. I'll be sure to try that too and let you know what happens

              --Ifewalter--

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #10

                Are formb.h and formb.cpp added to your project file?

                The error message

                bq. undeclared reference formB::formB(QWidget*).

                leads me to the guess that formb.cpp is not compiled at all.

                You can post your .pro file, we can check.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  ifewalter
                  wrote on last edited by
                  #11

                  tried all the above, same problem. Thanks guys. I'll like to concentrate my efforts on something else for now.

                  --Ifewalter--

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #12

                    Your setup is broken, the classes you have showed us are not complete (and erroneous too - wrong destructor name in forma.h). There's no chance to solve the problem from here.

                    Good luck with your further debugging efforts.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      TioRoy
                      wrote on last edited by
                      #13

                      Same problem here. Simulator build/run ok and Device build not.

                      @
                      void MainWindow::on_actionAbout_triggered()
                      {
                      DialogAbout about(this);
                      about.exec();
                      }
                      @

                      My .pro:

                      @
                      #-------------------------------------------------

                      Project created by QtCreator 2011-02-07T21:00:21

                      #-------------------------------------------------

                      QT += core gui

                      TARGET = QTBible
                      TEMPLATE = app

                      SOURCES += main.cpp dialogabout.cpp mainwindow.cpp

                      HEADERS += dialogabout.h
                      mainwindow.h

                      FORMS += dialogabout.ui
                      mainwindow.ui

                      OTHER_FILES +=
                      Welcome.html
                      Notes.txt

                      RESOURCES +=
                      resources.qrc

                      @

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        TioRoy
                        wrote on last edited by
                        #14

                        ifewalter,

                        I was searching into log to discover some issue and found this:

                        @Configuration unchanged, skipping qmake step.@

                        I don't know why, but my dialog was not included in Makefile, because qmake creates the makefile, and it is not running!!!!

                        Solution: manual delete the Makefile (in your project dir). Doing a rebuild..... Voi lá.

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          giesbert
                          wrote on last edited by
                          #15

                          What exactly is the error?
                          just posting code is not very helpful and will not result in too many answers...

                          Nokia Certified Qt Specialist.
                          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            TioRoy
                            wrote on last edited by
                            #16

                            Gerof,

                            I've create a application, add a Dialog and write a code to show the dialog. Simple.
                            Compiling for simulator ok, but for device gives me an error (the same problem of first post):

                            @
                            /NokiaQtSDK/Symbian/SDK/EPOC32/BUILD/Quati/develop/Nokia/QTBible/QTBIBLE_0XE3918DBB/GCCE/UDEB/mainwindow.o: In function `MainWindow::on_actionAbout_triggered()':

                            /Quati/develop/Nokia/QTBible/mainwindow.cpp:91: undefined reference to `DialogAbout::DialogAbout(QWidget*)'

                            /Quati/develop/Nokia/QTBible/mainwindow.cpp:95: undefined reference to `DialogAbout::~DialogAbout()'

                            /Quati/develop/Nokia/QTBible/mainwindow.cpp:95: undefined reference to `DialogAbout::~DialogAbout()'

                            make[2]: *** [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\QTBible.exe] Error 1

                            make[1]: *** [TARGETQTBIBLE_0XE3918DBB] Error 2

                            make[1]: Leaving directory `C:/Quati/develop/Nokia/QTBible'
                            @

                            I don't know what cause this. But Volker writes a clue:

                            [quote author="Volker" date="1296165540"]Are formb.h and formb.cpp added to your project file?

                            The error message

                            bq. undeclared reference formB::formB(QWidget*).

                            leads me to the guess that formb.cpp is not compiled at all.

                            You can post your .pro file, we can check.[/quote]

                            He was right: my dialogabout class was not compiling.

                            I've posted my .pro, but I know that information is not sufficient to resolve my problem.
                            So I decided to invetigate the log to find references of my class. But the first lines of log says:

                            @
                            Running build steps for project QTBible...
                            Configuration unchanged, skipping qmake step.
                            Starting: "C:/NokiaQtSDK/Symbian/SDK/epoc32/tools/make.exe" debug-gcce -w
                            C:\NokiaQtSDK\Symbian\SDK\epoc32\tools\make.exe: Entering directory `C:/Quati/develop/Nokia/QTBible'
                            .......
                            @

                            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