Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt Android Problem with sizes
I have a general problem with sizes for my qt application (Qt 5.3, normal Qt Android app, not QtQuick). The main problem is that many widgets are cutted to the right.
The application has one mainwindow with a stackwidget which holds the several other screens. The size policies are mainly set to Prefered or Expanding.
I am running out of idea and can't really see a system behind all this so I thought I could ask, maybe there is someone who has a idea what I am doing wrong.
Here is a picture of how it lookes like at the moment
And that is the way it looks on the desktop (and the way it should look)
So any thoughts on this issue are welcome :-)
Sanchir Kartiev last edited by
Hello! I think so size must be set by percentage (not a px).
tomasz3dk last edited by
Have you used layouts?
Hey, thanks for your replies.
@sanchkart I am not sure what you mean by "so"-size. Where do I have the possibility to set sizes in percentage?
@diabolic yes, the widgets in the stack are subclasses of QWidget and do have layouts.
In the main window, where the stack widget is located, are just references to these subclasses and the places in the stack widget are empty and therefore have no layouts (and can't be set). But this shouldn't be a problem, becouse the layout is set to the subclass widget.
There is also the strange behavior (even on desktop) that the size of the window increases when I switch to the window with the questions (as shown above). This is weird because there is no reason for the window to get bigger. As you can see in the screenshots, there is a lot of space between the "0" and the question and I can't even get this minimalized manually (both labels do have a Preferred size policy).
zhouxiang last edited by
use layout,you will no the program,
I am not sure how to do that.
The widget itself already has a layout and the widget ist placed as a user defined subclass in the stack widget.
If I try to force an additional layout I get something like
@QLayout: Attempting to add QLayout "" to SpielFenster "spielFenster", which already has a layout@
I also tried to put an extra widget in the page of the stack widget with layout (with the inner widget as user defined subclass) but it also doesn't helped.
I think I found the source of the problem: Over the stack widget is another widget (the home button as seen on the desktop screen). It is a horizontal spacer and a QPushButton together in a vertical layout. If I disable that everything fits in the window.
So the question is, why these widgets causes the window to get so big.
The homeButton is first shown when the question dialog comes up, so maybe the window needs to be resized again? Is there a way to tell qt to resize and pack the window manually?
Gianluca last edited by
From what I can guess, you are making some mistakes on using layouts.
Post some portion of your code to let us view as you are layout the widget, so we can see if there is something wrong.
adutzu89 last edited by
Sorry for my post, it was about something that was already done.
topocc last edited by
tanthinh1510 last edited by
I think you get screen available device. After that, you layout follow scale just get.