Results 1 to 8 of 8

Thread: resizeEvent - resizing unproportionally

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android
    Thanks
    7
    Thanked 20 Times in 20 Posts

    Default Re: resizeEvent - resizing unproportionally

    I think you're mixing things up here. It sounds like you want to resize your widget, but resizeEvent() is what get's called when the widget is resized, not what you call to do the resizing (since that would cause infinite recursion). Does the following basically sum up the logic of what you want to do?

    Qt Code:
    1. QRect r = yourLayout.geometry();
    2. yourWidget.resize(r.width(), r.height());
    To copy to clipboard, switch view to plain text mode 

    With regards to the painter code that you mention, it says the following in QWidget's resizeEvent() documentation: "The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler."

    I apologize if this isn't helpful or, God forbid, leads you further astray. As a newbie perhaps I should just keep my mouth shut but maybe someone will correct me and I'll learn too. :P

    edit: By the way, why ARE you trying to resize a widget based on the layout? Usually a widget is resized by the user directly (as in dragging a window's borders around) or by the layout manager in response to such direct action, or as more widgets are added to the layout. The fact that layouts don't have size/resize/resizeEvent methods is not accidental. I think that most of the time you're not supposed to be concerned with a layout's size...
    Last edited by Urthas; 13th August 2010 at 23:54.

Similar Threads

  1. resizeEvent help pls
    By munna in forum Newbie
    Replies: 10
    Last Post: 9th July 2010, 09:38
  2. Replies: 3
    Last Post: 2nd March 2010, 21:58
  3. What cannot be done in resizeEvent(..)?
    By nifei in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2008, 03:48
  4. Reimplement of resizeEvent
    By Shawn in forum Qt Programming
    Replies: 20
    Last Post: 27th May 2007, 11:04
  5. Question about resizeEvent
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 28th February 2006, 17:13

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.