How to resize the application with different screen sizes?
-
I want to automatically resize my application with different screen sizes, I have a StackedWidget in the app,
From this link I assign grid layout to the central widget. , Which has Automatic resizing with different screen size,but content of it doesn't resize
I add the grid layout on each page of stackWidget but the button,lineEdit,.... get too wide and
Cannot resize or change location of it
With assign grid layout on central widget all content of it should be get layout?
How do I assign layouts to pages that can resize the qlineEdit, button ...?! -
Hi
You are doing it right,
however, both QLineEdit and QPushButton have Fixed policy as default
preventing them from growing/use all space.If you do
then they grow
Anyway, you need both layout on CentralWidget to size the stackedwidget and then
on each page, you also need a layout. (which you seem to do ) -
When I using buttons, lineEdits, labels, comboBox on a page, for example, I use 30 items in grid layout and run the program with xcb platform, in raspberry pi with a 800 x 480 display(5inch) , This will cause the app's page to be dragged down and right and not everything show completely the window minimize,closer button is not specified. But When I use fewer items, it's okay,
I need to use 30 items in one page how can I fixed the program size ?
I use this in main.cpp:QRect rec = QApplication::desktop()->screenGeometry(); int height1 = rec.height(); int width1 = rec.width(); w.resize(width1,height1);
and this in mainWindow.cpp:
this->setStyleSheet( "#centralWidget { " " border-image: url(:/new/prefix1/Untitled-7.jpg) 0 0 0 0 stretch stretch;" "}");
-
Hi,
Why not use showFullScreen directly ?
What are these 30 items ? It's quite a lot on a small screen.
You might want to consider using QScrollArea to allow your user to scroll up and down to see your widgets.
Depending on your application, you might wan to break down your UI in smaller elements.