[solved] automatically anchor elements when phone rotates
-
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
-
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.
-
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. -
Moved to Mobile & Embedded (although it could have been General/Desktop.)
-
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 ?
-
"Layouts":/doc/qt-4.8/layout.html will give you the functionality you're looking for. (Look at "Stretch Factors" for percentage widths.)
-
This looks appropiate. Thanks for the help, and now I also know where to find the forum.