Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: what layout or combination of layout should use in this case?

I am working on a Qt Project and for this project I require to design something like this:

Design

I have designed so far in Qt Creator and I have the component ready, but when I am trying to add widget in different layouts, I am not getting the shapes I want. What should I do to make my application resizable?

Catches:

  • Sidebar has fixed width, which means for horizontal increment of window size the sidebar's horizontal width won't increase. Sidebar itself is a widget.
  • upperbar's vertical width is fixed (if possible). Which means, during vertical window size increment the upperbar can't become vertically wider. And it itself is also a widget.
  • the widgets by the side of sidebar are in a qstackedwidget.
like image 741
Shakib Ahmed Avatar asked Dec 25 '22 07:12

Shakib Ahmed


1 Answers

Nested layouts:

(green square = QStackedWidget)

enter image description here

Steps:

[Definition]

H(x, y, ...) = horizontal layouts on x, y, ...; where x, y, ... are widget(W#) or Layout(L#)

V(x, y, ...) = horizontal layouts on x, y, ...; where x, y, ... are widget(W#) or Layout(L#)

  • Step 1: V(W1, W2) = L1
  • Step 2: H(W3, L1) = L2
  • Step 3: V(W4, L2) = L3
  • Step 4: Set L3 as the layout of current page of the StackedWidget layout
  • Step 5: H(W5, StackedWidget) = L4
  • Step 6: H(W6, a spacer, W7) = L5
  • Step 7: V(L5, L4)

Notice that W6 and W7 are fixed in horizontal size (or set maximum on it), the spacer between them acts as the only resizable widget in the layout L5.


And here is the hierarchy:

enter image description here

like image 169
Tay2510 Avatar answered Dec 27 '22 21:12

Tay2510