Results 1 to 3 of 3

Thread: show and resize sequence

  1. #1
    Join Date
    Dec 2008
    Location
    Paris, France
    Posts
    34
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default show and resize sequence

    Hi all,

    This is a question about the sequence in which child widgets are shown and resized when a parent dialog is displayed.
    What I'd liked to do :
    1. Just before the QDialog is shown, get the size of a QTableView inside the QDialog
    2. Adjust the column widths
    3. Show the QDialog

    Unfortunately, if I try to resize the columns either in an override of the QDialog's showEvent or resizeEvent, the QDialog has indeed been resized, but not yet the child widgets

    Unless it's possible to get the resized QTableView before the dialog is shown, I'll have to subclass QTableView and override it's resizeEvent, which is bit cumbersome.

    Is there another (and proper) way to do this ?

    Thanks for any insight.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: show and resize sequence

    Install event filter on the view and resize the columns there.

    Qt Code:
    1. QTableView* v = new QTableView( this );
    2. v->installEventFilter( this );
    3.  
    4. bool eventFilter( QObject* o, QEvent* e )
    5. {
    6. if( o == v && e->type() == QEvent::Resize )
    7. {
    8. // get size from event, resize columns here
    9. }
    10.  
    11. return QDialog::eventFilter( o, e );
    12. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to Spitfire for this useful post:

    Windsoarer (20th May 2012)

  4. #3
    Join Date
    Dec 2008
    Location
    Paris, France
    Posts
    34
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: show and resize sequence

    Works nicely
    Thanks

Similar Threads

  1. Replies: 1
    Last Post: 27th January 2012, 09:33
  2. Replies: 1
    Last Post: 14th April 2011, 10:40
  3. Sequence images player
    By hhe in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2010, 08:13
  4. Frame sequence
    By bmn in forum Qt Programming
    Replies: 7
    Last Post: 22nd May 2008, 21:57
  5. Model, view, resize to show all data
    By jcr in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2006, 20:59

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.