Results 1 to 2 of 2

Thread: sizeHint() and heightForWidth(int) problem

Hybrid View

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

    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,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: 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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.