Results 1 to 4 of 4

Thread: How to change between QMainWindows???

  1. #1
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to change between QMainWindows???

    Hello,

    I have two forms (UI's) and main.cpp load form1.
    Now in form1.cpp I have a botton to load form2 and close form1.

    classForm2 *form2 = new classForm2();
    form2->show();
    form1->close();

    Well, If I execute this code, it works fine, but there is a small problem, after close form1 class, appear green background screen and later, form2 is loaded.

    My question is, is it possible to avoid this behaviour???

    Best regards.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to change between QMainWindows???

    Are you really talking of two QMainWindows? Then closing the first and showing the second is no good idea, because there should be only one QMainWindow in your application. If you just want to have other widgets on the screen you might should a look at QStackedWidget (e.g.).

  3. The following user says thank you to Lykurg for this useful post:

    webquinty (16th October 2009)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to change between QMainWindows???

    Quote Originally Posted by Lykurg View Post
    Then closing the first and showing the second is no good idea, because there should be only one QMainWindow in your application.
    That's not true, you can have as many of them as you want - it's a normal window like any other.

    But this doesn't change the fact we probably don't know what green screen is the author of this thread talking about...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    webquinty (16th October 2009)

  6. #4
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to change between QMainWindows???

    Thanks a lot.

    I am going to read Qt documentation about this class.

    Best regards

Similar Threads

  1. Change database data in the QTabelView
    By sophister in forum Qt Programming
    Replies: 3
    Last Post: 9th April 2009, 16:40
  2. Change cursor & status during Drag & Drop
    By ronlongo in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2008, 16:56
  3. Is it possible to change the cursor on a QGraphicsView?
    By draftpunk in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2008, 18:43
  4. statusBar() message color change
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 23:20
  5. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.