Results 1 to 2 of 2

Thread: sizeHint() and heightForWidth(int) problem

  1. #1
    Join Date
    Oct 2008
    Location
    Beijing China
    Posts
    77
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    21
    Thanked 3 Times in 3 Posts

    Question sizeHint() and heightForWidth(int) problem

    Hi, all,
    I called QWidget::sizeHint() and heightForWidth(int) each time before the widget is shown and met a strange problem. I got different sizes the 1st time and 2nd time, and then get the same value each time, just except the first sizeHint(). Same issue exists in heightForWidth(int w). I don't know why. and this makes it look weird since for the first time the widget is much bigger than other times.

    BTW: i put the widget in a QGrphicsProxyWidget in a QGraphicsScene, does this effect its sizeHint?

  2. #2
    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: sizeHint() and heightForWidth(int) problem

    Maybe the widget was not yet polished when you asked for its sizeHint()? You may call QWidget::ensurePolished() before doing that to make sure the widget is setup properly.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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.