[solved] automatically anchor elements when phone rotates
-
wrote on 22 Apr 2012, 11:49 last edited by
Hello,
I created a new Qt Widget Project -> Mobile Qt Application and want to automatically apply this code to anchor the pushbutton always when the phone rotates (I have ScreenOrientationAuto, btw.)
@ui->pushButton->setGeometry(0,0,ui->centralWidget->width(),ui->centralWidget->height() / 2);@
Thank you
-
wrote on 23 Apr 2012, 11:22 last edited by
If you are using QWidgets, then this is the wrong forum:-)
QWidgets can to do the anchoring that QML does. You can archive this effect using a layout though.
-
wrote on 23 Apr 2012, 15:34 last edited by
Yes, I am using QWidgets in this project now.
Can you tell me a forum to ask about Layout for anchoring ?
Edit: I now found the layout thing in the designer, but I still need a forum to ask questions about things conserning QWidget. -
wrote on 23 Apr 2012, 18:39 last edited by
Moved to Mobile & Embedded (although it could have been General/Desktop.)
-
wrote on 23 Apr 2012, 19:30 last edited by
Can I also work with ratios, like if I have two parts, that the first part takes 80% and the rest 20% ? How to set that ?
-
wrote on 23 Apr 2012, 19:32 last edited by
"Layouts":/doc/qt-4.8/layout.html will give you the functionality you're looking for. (Look at "Stretch Factors" for percentage widths.)
-
wrote on 23 Apr 2012, 19:37 last edited by
This looks appropiate. Thanks for the help, and now I also know where to find the forum.
2/7