Results 1 to 9 of 9

Thread: Resizing a QDialog to the content size

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: Resizing a QDialog to the content size

    If I show it one, two... three times before getting the size, i've got the same result .
    I'll try "adjustSize()"

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

    Default Re: Resizing a QDialog to the content size

    Quote Originally Posted by Nyphel View Post
    If I show it one, two... three times before getting the size, i've got the same result .
    A widget is not shown immediately after calling show(). A show event is scheduled and the widget comes visible later when the control returns to the event loop.
    J-P Nurmi

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

    Default Re: Resizing a QDialog to the content size

    You can override showEvent() and set the size there if you want.

  4. #4
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: Resizing a QDialog to the content size

    Oki, thanks.

    I override the showEvent and now it works fine.
    I set fit the columns/rows size to the content, and then I fit the QDialog to the QTable content size.

    I don't understand why that didn't work before.
    I'm sure that the QDialog was shown before trying to resize it .

    Thanks everybody

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

    Default Re: Resizing a QDialog to the content size

    How did you make sure it was shown before resizing it?

  6. #6
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: Resizing a QDialog to the content size

    Because I show it with a button,
    and then I push another button to resize it ^_^

Similar Threads

  1. Replies: 1
    Last Post: 24th October 2006, 17:40
  2. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 23:14
  3. Dynamically resizing in QT 3
    By kroenecker in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 19:37

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.