PDA

View Full Version : Layout which I can put in front of another



anthaet
6th February 2014, 16:04
Hi.

This is a picture what I would like to achieve.
10023

Left Widget contains some basic widgets (QPushButtons, QLineEdit etc.) and will be able to show and hide using some keyboard shortcut. But most important is to Left Widget did not decrease width of Center Widget but it was something like put in front of it when showed.

Bottom Widget contains just few basic widgets, and also must be able to show/hide, but don't need to put in front of Central Widget.

Center Widget fills rest of the free space of QMainWindow and it always be visible.

I tried to use BorderLayout, and it partially works, but I have two obstacles:
- I can't hide Left Widget (BorderLayout widgets don't have hide() option so I would have to hide every containing widget one by one)
- I can't do something as I mentioned to put Left Widget on front of Central Widget without decreasing its width

Can you suggest me some layouts or ideas so I can do this the most easily?

anda_skoa
6th February 2014, 17:26
What you want is a widget that is not part of the layout.

Needs manual adjustment of height when its parent changes height, but that can easily be done using an event filter.

Cheers,
_

adutzu89
7th February 2014, 19:15
What you want is a widget that is not part of the layout.

Needs manual adjustment of height when its parent changes height, but that can easily be done using an event filter.

Cheers,
_
+ what anda_skoa said with adding: create a frameless widget(using window flags to remove your window frame) and add/show it whenever you need.
For the bottom and central widgets, why not add them in a QGridLayout?


I can't hide Left Widget (BorderLayout widgets don't have hide() option so I would have to hide every containing widget one by one)
If I am understanding this correctly you are saying that you add the widgets from inside left and bottom directly into the borderlayout, and not creating left/bottom widget and after that add other widgets to them?