Results 1 to 2 of 2

Thread: MainWindow won't resize, why does this work?

  1. #1
    Join Date
    Jun 2010
    Posts
    12
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default MainWindow won't resize, why does this work?

    I have a reimplementation of QMainWindow, whose contents change size dynamically. When they shrink, I can't get MainWindow to shrink along with them. When I manually adjust the size of the window, it automatically snaps to the right size, but no combination of setGeometry(), resize(), adjustSize() or fiddling with size policies and size hints has worked. I fumbled across a solution by calling:

    Qt Code:
    1. hide();
    2. showMinimized();
    3. show();
    4. showNormal();
    5.  
    6. QResizeEvent *event = new QResizeEvent( QSize(0,0), QSize(0,0) );
    7. QCoreApplication::sendEvent( this, event );
    To copy to clipboard, switch view to plain text mode 

    which works.. but obviously isn't ideal. And I'm not quite sure why it works. Anyone have any thoughts?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: MainWindow won't resize, why does this work?

    Most likely you have overridden something in your main window.
    Post the complete code of the main window

Similar Threads

  1. Replies: 1
    Last Post: 1st May 2010, 23:03
  2. Replies: 2
    Last Post: 13th December 2009, 20:27
  3. MainWindow
    By amagdy.ibrahim in forum Newbie
    Replies: 6
    Last Post: 14th June 2008, 14:12
  4. Replies: 2
    Last Post: 22nd January 2008, 16:10
  5. MainWindow mask
    By SirBabyface in forum Qt Programming
    Replies: 0
    Last Post: 11th July 2007, 15:12

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.