Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

heightForWidth

$
0
0
Trying to make my top level window maintain aspect ratio when resizing : In my header I have : int heightForWidth(int w) const ; QSize sizeHint() const; In my cpp : In constructor , QSizePolicy myPolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);  setSizePolicy(myPolicy);  sizePolicy().setHeightForWidth(true); int MyClass::heightForWidth(int w)  const {         return w*8/10; }   QSize MyClass::sizeHint() const {         int w =  1000;         return QSize( w, heightForWidth(w) ); } It’s not working . heightForWidth is not being called when I resize the window . It appears this is a problem for a top level window . Is there any solution ?

Viewing all articles
Browse latest Browse all 13965

Trending Articles