Results 1 to 7 of 7

Thread: SetCentralWidget in mainWindow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question SetCentralWidget in mainWindow

    I have a mainWindow, and I call a dialog. In this dialog, I have a PushButton, and when I click close a dialog ( close(); ). I close but don't close a mainWindow, close only the dialog. I need appear other dialog when i click in this button, it is possible??


    sorry my bad english...

    URGENT...

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    8
    Thanked 133 Times in 128 Posts

    Default Re: SetCentralWidget in mainWindow

    you can check the result code of exec() or done() and then show up the other dialog

  3. #3
    Join Date
    Apr 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: SetCentralWidget in mainWindow

    I go to try to explain the problem better, what the following one is transferred and: I have 1 mainwindow, and 2 dialogs.

    When beginning the program opens in mainwindow, where it has 1 button to go for the XDIALOG, in this XDIALOG opens inside of mainwindow (setCentralWitget).

    I am in the XDIALOG, and clico in a button and want that it inside appears of same centralWitget the YDIALOG.
    The problem is that I do not know as to inside make this exchange of DIALOGS of centralWitget of mainWindow.

  4. #4
    Join Date
    Apr 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: SetCentralWidget in mainWindow

    I use this in mainWindow:

    x = new XDialog;
    this->setCentralWidget(x);

  5. #5
    Join Date
    Apr 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: SetCentralWidget in mainWindow

    Just an idea, but I would have a QFrame object as the central widget. Then use that as the parent for your XDIALOG and YDIALOG widgets. You can then make the appropriate one visible in response to the buttons. Have you considered putting the dialogs onto a QTabWidget and let the user select what they want to do?

  6. #6
    Join Date
    Apr 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: SetCentralWidget in mainWindow

    I take a screenshots...
    1- start program:


    2- click to dialog A, and this apear in centralWitget part of mainwindow


    3- click to close a dialog A, but i need lauch a DIALOG B, in this same centralWitget, but only close a dialog and don't launch nothing

  7. #7
    Join Date
    Apr 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: SetCentralWidget in mainWindow

    OK, I think I see what you want to do, but...
    The QDialog is supposed to be a top level widget - ie it is managed by your window manager and should have the appropriate decorations, such as a title bar and close button.
    I would suggest looking at the tutorials for wizzards.

Similar Threads

  1. setCentralWidget problems
    By tlerner in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2009, 21:26
  2. Problem with setCentralWidget
    By blm in forum Qt Programming
    Replies: 3
    Last Post: 2nd September 2008, 12:33
  3. QMainWindow setCentralWidget from ui widget, Qt4
    By alan in forum Qt Programming
    Replies: 5
    Last Post: 13th May 2008, 13:00
  4. Problems with setCentralWidget
    By Rockem in forum Qt Programming
    Replies: 21
    Last Post: 8th March 2008, 23:57
  5. Replies: 4
    Last Post: 7th March 2007, 09:45

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.