widget overlapping using layout
-
wrote on 21 Jan 2019, 10:55 last edited by
hi guys,,suggest me to solve this problem
1.I want to add 2 sub widgets in this root widget.
2.second sub widget is up to first sub widget.
3.We have loading widget in each ui file.
4.loading widget is overlapped above other sub widgets.
I want to add like this,in this layout mode??
I want to add such above by applyiing layout because our app is small in high resolution coms,To fix this, we must make resizable app and apply layout? -
hi guys,,suggest me to solve this problem
1.I want to add 2 sub widgets in this root widget.
2.second sub widget is up to first sub widget.
3.We have loading widget in each ui file.
4.loading widget is overlapped above other sub widgets.
I want to add like this,in this layout mode??
I want to add such above by applyiing layout because our app is small in high resolution coms,To fix this, we must make resizable app and apply layout?hi @Bharth ,
As far as I know, there's only one way to stack widgets on top of each other, while using a layout.
That is QGridLayout
the addWidget functions allows you to place multiple widgets inside the same Cell and all will be effected by the Layout and it's resizing mechanism.However this is a c++-code only way. AFAIK you can not do this via the Designer-Plugin.
Otherwise, you'll have to override the resizeEvent- function of the parent widget and manually adjust the other widgets in that slot.
-
Hi,
To add to @J-Hilk, can you provide one or more pictures of what you would like to achieve ?
-
Hi,
To add to @J-Hilk, can you provide one or more pictures of what you would like to achieve ?
wrote on 22 Jan 2019, 04:56 last edited by Bharth -
QStackedLayout comes to mind to have the widgets on top of each others.
-
wrote on 23 Jan 2019, 05:10 last edited by Bharth
thank you for your reply
In desiging mode how to apply stackedlayout,,,,
QStackedlayout not showing in qt ,its showing only 4 layouts
vertical,horizontal,grid and form layoutthanks in advance
-
wrote on 23 Jan 2019, 06:29 last edited by
i got solution thanks for your reply
i used resizeEvent functionin the constructor added below 4 lines
Qsize window = this->size();
la=new QLabel(this);
la->setStylesheet("background-color:red");
la->setAlignment(Qt::AlignCenter);
la->setText("testing");Void MindowWindow::resizeEvent(QResizeEvent* event)
{
QSize window=thia->size();
la->setMinimumWidth(window.width());
la->setMinimumHeight(window.width());
la->setMaximumWidth(window.width());
la->setMaximumHeight(window.width());
QMainwindow::resizeEvent(event);
} -
wrote on 23 Jan 2019, 06:40 last edited by Maaz Momin
-
QStackedLayout comes to mind to have the widgets on top of each others.
wrote on 22 Jan 2024, 01:17 last edited by@SGaist Can I Use QStackedLayout , two overlay two widgets ? i think what OP wanted to know is , two widget on top of each other , the below widget probably have some child widgets like buttons and other controls, the top widget probably have a logo or something , which is little transparent, so the widget below(with buttons) can also be viewed, .. So far my understanding , QStackedLayout is used by QStackedWidget , and only one widget is visible. but to be able to have both widget visble with some trasnparency , and both of them are sibling , not parent of each other , how one can acheive it . ?
Thank you in Advance
-
@SGaist Can I Use QStackedLayout , two overlay two widgets ? i think what OP wanted to know is , two widget on top of each other , the below widget probably have some child widgets like buttons and other controls, the top widget probably have a logo or something , which is little transparent, so the widget below(with buttons) can also be viewed, .. So far my understanding , QStackedLayout is used by QStackedWidget , and only one widget is visible. but to be able to have both widget visble with some trasnparency , and both of them are sibling , not parent of each other , how one can acheive it . ?
Thank you in Advance
@sani1486 hi and welcome to devnet,
Check the stackingMode property. It allows to check whether you see on widget at a time or all of them.