Results 1 to 3 of 3

Thread: QMainWindow child of a QDialog

  1. #1
    Join Date
    Aug 2007
    Posts
    64
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QMainWindow child of a QDialog

    I'm trying put a QMainWindow as a child of a QDialog!

    My application have a QMainWindow, but I need a print view, and just with QMainWindow I can create a QToolBar with Qt Designer.
    I created a var of my new QMainWindow type and putted his method show(), but this new QMainWindow isn't showed!!

    How can I put this new QMainWindow inside my application??


  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMainWindow child of a QDialog

    I created a var of my new QMainWindow type and putted his method show(), but this new QMainWindow isn't showed!!
    If you created that var on the stack, in some function, it won't work, because the object will get destroyed as soon as the function exits.
    Create the window instance on the heap(with new), and don't forget to delete it when you finish using it/or set the delete on close flag.

  3. #3
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMainWindow child of a QDialog

    Hi,
    i have mainWindow in dialog too, but for different reasons - i needed tab docking widgets with parts of a wizard that could be rearranged.

    I found issue that when widgets are docked with vertical nesting(initially they are tabbed & only bottom dock area is available) central widget expands to large size(larger that maximum size) even if it have maximum policies.
    Does anyone knows how to prevent central widget from resizing?
    See GrEEn (Graphics Effects Environment)
    http://sourceforge.net/project/platf...roup_id=232746
    a qt-based plugins oriented MDI image processing application(contains also qt plugins like styles & imageformats).

Similar Threads

  1. QDialog margin and spacing
    By TheRonin in forum Qt Programming
    Replies: 4
    Last Post: 29th October 2007, 11:11
  2. Replies: 14
    Last Post: 19th March 2007, 09:48
  3. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 10:03
  4. Qdialog as a child widget
    By dave in forum Newbie
    Replies: 12
    Last Post: 14th November 2006, 10:43
  5. Replies: 1
    Last Post: 28th July 2006, 15:10

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.