Have the main UI remain fixed when expanding
-
@JonB What layout should I use? Also, my bad but here's the missing top half of the object inspector:

@Rangerguy128 said in Have the main UI remain fixed when expanding:
Also, my bad but here's the missing top half of the object inspector:
From this perspective it doesn't look quite right what you've done.
It looks that you haven't applied the layouts TO your widgets, but added new layouts on top of them. You still have the red-sign that stands for "I have no layout" :)horizontalLayout_2should be the "build-in" layout ofcentralWidget.
Same forverticalLayoutandwidget_2.@Pl45m4 said in Have the main UI remain fixed when expanding:
right-click in object inspector (on the left) on your QWidget widget, click "Lay out" and "vertical". Then do the same on your QMainWindow where your select "Lay out horizontal"
See what I wrote here.
E.g. to set a layout TOcentralWidgetand to make the layout work property with your window, right-click the row in Object Inspector that saysMainWindow(the very first one). There you can select a layout easily, but you have to have content within your widget's bounds... you can't set a layout to an empty widget... Don't ask why... QtDesigner is not the perfect tool :)
Therefore I've said you need to create your inner layouts and content, before you can apply a layout to yourcentralWidgetor your newwidget.Edit:
Since you replied to @JonB , is this screenshot from Object Inspector the current setup or is everything working now? Does it look like my setup? No red signs?!
-
@Rangerguy128 said in Have the main UI remain fixed when expanding:
Also, my bad but here's the missing top half of the object inspector:
From this perspective it doesn't look quite right what you've done.
It looks that you haven't applied the layouts TO your widgets, but added new layouts on top of them. You still have the red-sign that stands for "I have no layout" :)horizontalLayout_2should be the "build-in" layout ofcentralWidget.
Same forverticalLayoutandwidget_2.@Pl45m4 said in Have the main UI remain fixed when expanding:
right-click in object inspector (on the left) on your QWidget widget, click "Lay out" and "vertical". Then do the same on your QMainWindow where your select "Lay out horizontal"
See what I wrote here.
E.g. to set a layout TOcentralWidgetand to make the layout work property with your window, right-click the row in Object Inspector that saysMainWindow(the very first one). There you can select a layout easily, but you have to have content within your widget's bounds... you can't set a layout to an empty widget... Don't ask why... QtDesigner is not the perfect tool :)
Therefore I've said you need to create your inner layouts and content, before you can apply a layout to yourcentralWidgetor your newwidget.Edit:
Since you replied to @JonB , is this screenshot from Object Inspector the current setup or is everything working now? Does it look like my setup? No red signs?!
-
@Rangerguy128 said in Have the main UI remain fixed when expanding:
the map image doesnt expand with the black label.
If the image is restricted by its height, it will not expand to the side. You might be able to fix this by putting the image inside a scroll area.
For the buttons on the left you might want to add a vertical spacer item at the bottom of the layout (which would add a lot of space at the bottom but prevent the buttons from being spread out).
-
@Rangerguy128
Just to say, this (the second one) is much better! You always want to get rid of any "red no-entry" signs for missing layout shown in Object Inspector. Nothing will behave right till you do. -
@Rangerguy128 said in Have the main UI remain fixed when expanding:
@Pl45m4 I have two windows just in case: one that was my own (the former), and the other following @JonB's instructions (the latter).
Yes the 2nd is the obviously the better one.
That's what I also described here:@Pl45m4 said in Have the main UI remain fixed when expanding:
The final result should look like this:
@Pl45m4 said in Have the main UI remain fixed when expanding:
What is your goal after all? What do you want to do with this map and these "radio buttons"?
There might be a better way, depending on what you have in mind.I was asking this, because depending on what you want to do, you better use
QGraphicsViewor at least put your map in some scrollable widget as @SimonSchroeder suggested...So if I understand correctly, you want to anchor those radio buttons to fixed postions on your map (on your image label) and then be able to toggle them and do something after that? Is that all?
-
@Rangerguy128 said in Have the main UI remain fixed when expanding:
@Pl45m4 I have two windows just in case: one that was my own (the former), and the other following @JonB's instructions (the latter).
Yes the 2nd is the obviously the better one.
That's what I also described here:@Pl45m4 said in Have the main UI remain fixed when expanding:
The final result should look like this:
@Pl45m4 said in Have the main UI remain fixed when expanding:
What is your goal after all? What do you want to do with this map and these "radio buttons"?
There might be a better way, depending on what you have in mind.I was asking this, because depending on what you want to do, you better use
QGraphicsViewor at least put your map in some scrollable widget as @SimonSchroeder suggested...So if I understand correctly, you want to anchor those radio buttons to fixed postions on your map (on your image label) and then be able to toggle them and do something after that? Is that all?
@Pl45m4 said in Have the main UI remain fixed when expanding:
So if I understand correctly, you want to anchor those radio buttons to fixed postions on your map (on your image label) and then be able to toggle them and do something after that? Is that all?
Yes, exactly what I'm trying to do! Can you demostrate it if possible? I'm trying to mess around with the app but I'm still a newbie on how it works.
-
@Pl45m4 said in Have the main UI remain fixed when expanding:
So if I understand correctly, you want to anchor those radio buttons to fixed postions on your map (on your image label) and then be able to toggle them and do something after that? Is that all?
Yes, exactly what I'm trying to do! Can you demostrate it if possible? I'm trying to mess around with the app but I'm still a newbie on how it works.
@Rangerguy128 said in Have the main UI remain fixed when expanding:
you want to anchor those radio buttons to fixed postions on your map
The easy way is to anchor to the top-left corner because this position is fixed independently of the image size.
-
@Rangerguy128 said in Have the main UI remain fixed when expanding:
you want to anchor those radio buttons to fixed postions on your map
The easy way is to anchor to the top-left corner because this position is fixed independently of the image size.
@mpergand Any way to do that? By top left corner, you mean of the image or the layout where the image is in?
-
@mpergand Any way to do that? By top left corner, you mean of the image or the layout where the image is in?
You can create a widget outside of any layout.
It will be positioned at 0,0 of the parent widget you give:auto frame=new QFrame(some parent widget):
frame->setFrameShape(QFrame::Box);
// you can move it then after
frame->move(10,10); -
You can create a widget outside of any layout.
It will be positioned at 0,0 of the parent widget you give:auto frame=new QFrame(some parent widget):
frame->setFrameShape(QFrame::Box);
// you can move it then after
frame->move(10,10);@mpergand ah okay, so should I place my map and the radio buttons in a widget, and then apply the lines of code you mentioned on python? And the widget needs to be outside of the layout, right?
-
@mpergand ah okay, so should I place my map and the radio buttons in a widget, and then apply the lines of code you mentioned on python? And the widget needs to be outside of the layout, right?
@Rangerguy128
As a test you can set the parent to your map:auto frame=new QFrame(your map widget):
and see how it looks.

