Results 1 to 4 of 4

Thread: resizeEvent from parent to child?

  1. #1
    Join Date
    Jan 2007
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default resizeEvent from parent to child?

    I have a dialog with a tab widget that is part of a grid layout. Within the tab widget is a frame. Within the frame is another widget that implements resizeEvent.

    When I resize the dialog, the tab widget and frame resize as expected, but the widget within the frame does not.

    What is the best way to get the widget that is inside the frame to resize along with the frame?

    Thank you,
    Chas

  2. #2
    Join Date
    Jan 2007
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: resizeEvent from parent to child?

    Actually, the widget within the frame is resizing with the frame.

    What i didnt realize is that a maximize event was not a resizeEvent, so my test was invalid.

    So what I am trying to do now is catch a maximize event so I can handle it.

    I am trying this, but it doesnt seem to be working.

    Qt Code:
    1. void COutput::changeEvent(QEvent* event)
    2. {
    3. switch (event->type())
    4. {
    5. case QEvent::WindowStateChange:
    6. {
    7. qDebug() << "state change";
    8. }
    9. default:
    10. QWidget::changeEvent(event);
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 

    What am I doing wrong here?

    p.s. thenagain, I am probably wrong to think I can catch such a window event within a widget.. which leaves me in somewhat of a quandry...

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: resizeEvent from parent to child?

    Quote Originally Posted by ChasW View Post
    When I resize the dialog, the tab widget and frame resize as expected, but the widget within the frame does not.

    What is the best way to get the widget that is inside the frame to resize along with the frame?
    Add the widget inside the frame into a layout and install the layout on the frame.
    J-P Nurmi

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: resizeEvent from parent to child?

    Maximize is only relevant with top level widgets and honestly I don't see how would maximising a child widget work...

Similar Threads

  1. Replies: 1
    Last Post: 28th July 2006, 14:10
  2. initialize child widgets within parent?
    By ucomesdag in forum Newbie
    Replies: 6
    Last Post: 6th June 2006, 08:11
  3. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  4. Infinite loop - resize parent from child
    By bitChanger in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2006, 13:21
  5. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 15: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.