Results 1 to 11 of 11

Thread: how to change 1st mainwindow's frame by 2nd window's frame

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to change 1st mainwindow's frame by 2nd window's frame

    You have a QMainWindow and a QDialog. Both of these are intended to create a separate window on the desktop when show() (or exec()) is called... I assume this is what you see. Instead, when you click a button in the main window you want the content that is displayed in the current dialog to be shown as part of the content area of the main window. It's not clear whether that will be:
    1. Replacing existing content in the "third frame". You generally use a QStackedWidget to show alternate widgets in the same layout space.
    2. The "third frame" is normally hidden and only shown, with the dialog's contents, on demand.

    Case 1 is demonstrated in the attached example based on yours. I mocked up the main window content. Flip between options in the stack using the two push buttons.
    I changed your FirstDialog class to QWidget because it really is not a dialog. It is embedded in the main window designer ui by promoting page 2 of the stacked widget.
    You will notice that the QFrame* member variables you put in the two headers are neither present nor needed.

    Case 2 is handled differently and has more complicated implications for layout handling. Take a look at the Qt Extension Example for guidance.
    Attached Files Attached Files
    Last edited by ChrisW67; 16th December 2018 at 03:56.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  2. #2
    Join Date
    Dec 2018
    Posts
    6
    Qt products
    Qt4 Qt5

    Default Re: how to change 1st mainwindow's frame by 2nd window's frame

    Hi,
    first of all, I ask you to excuse me all (even d_stranz). i was giving up qt. i'm doing good things in c and a little in c++. i'm thinking qt is good and well designed. i come back to read all and will be back. thanks a lot chrisw67.

Similar Threads

  1. Replies: 1
    Last Post: 5th December 2013, 06:46
  2. Frame-by-frame event handling?
    By QTNovice in forum Qt Programming
    Replies: 1
    Last Post: 28th October 2013, 22:32
  3. Video Parsing - Frame by Frame
    By ctote in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2010, 18:30
  4. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2007, 01:35
  5. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 17
    Last Post: 29th April 2006, 01:42

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.