Results 1 to 19 of 19

Thread: Switching between two ui forms / QMainWindow screens

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Switching between two ui forms / QMainWindow screens

    I think we need to start from zero, because something is clearly wrong with what you are doing now.

    Please write and run these two programs. You can simply comment out the lines in your current main.cpp and replace them with these lines:

    Qt Code:
    1. #include <QtWidgets/QApplication>
    2. #include "RaptorCoreGUI.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7.  
    8. RaptorCoreGUI w;
    9. w.show();
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include <QtWidgets/QApplication>
    2. #include "RaptorLrsGUI.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7.  
    8. RaptorLrsGUI w;
    9. w.show();
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

    In each case, do you see the windows you expect to see?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. #2
    Join Date
    Sep 2017
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Switching between two ui forms / QMainWindow screens

    Yes I can see the windows (attached)

    IMG-4835 --> coreGUI
    ING-4836 --> lrsGUI
    Attached Images Attached Images

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Switching between two ui forms / QMainWindow screens

    OK, good. The problem is not with your Raptor* widgets.

    Next step. Do you see the RaptorLrsGUI window when you run this code?

    Qt Code:
    1. #include <QtWidgets/QApplication>
    2. #include <QtWidgets/QMainWindow>
    3. #include <QtWidgets/QStackedWidget>
    4. #include "RaptorLrsGUI.h"
    5.  
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9.  
    10. QStackedWidget * pStack = new QStackedWidget( &w );
    11. RaptorLrsGUI * pLrs = new RaptorLrsGUI;
    12. pStack->addWidget( pLrs );
    13. w.setCentralWidget( pStack );
    14. w.show();
    15. return a.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 

    If it does, substitute "w.showMaximized()" for "w.show()". Does it still work?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Switching between two forms with button click
    By gfernandes in forum Newbie
    Replies: 3
    Last Post: 30th August 2013, 12:50
  2. Multiple screens navigation
    By keyga in forum Qt Quick
    Replies: 1
    Last Post: 23rd December 2012, 10:28
  3. Problem when switching between forms in QML
    By duc_bkav in forum Qt Programming
    Replies: 0
    Last Post: 24th November 2011, 02:52
  4. Switching between 2 Forms
    By strateng in forum Qt Programming
    Replies: 6
    Last Post: 4th June 2010, 08:09
  5. Multiple Forms and vertical layout in forms
    By eva2002 in forum Qt Programming
    Replies: 0
    Last Post: 13th January 2010, 05:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.