How to always fix the button to the right side using QtDesigner?
-
Hello. I have a GUI where a button always needs to be fixed to the right side of the screen, but when I change the window size the button does not follow the right edge of the screen. I am a beginner, it seems to me a simple problem for those who are already veterans, how can I solve this problem?
the button should not be in the middle of the bar, but pasted on the right edge of the GUI.
-
@_jao_victor_
Assuming you are saying you are designing this in Creator/Designer, are you using layouts? -
@_jao_victor_
So what have you done in the designer to tell it where you want the button?Also you say
where a button always needs to be fixed to the right side of the screen,
the button does not follow the right edge of the screen.and also
fix the button to the left side using QtDesigner
the button should not be in the middle of the bar but pasted to the left edge of the GUIso I don't know which you want.
-
@_jao_victor_
Put the bottom bar and the button in a horizontal layout. -
@_jao_victor_
Your title and first line read:How to always fix the button to the left side using QtDesigner?
GUI where a button always needs to be fixed to the right side of the screen
Those do not seem consistent to me. As per @mpergand, are your "bottom bar and the button in a horizontal layout"?
-
@_jao_victor_
And the "red no entry" symbol Designer shows on theQFrame
warns you that it needs a layout. -
@mpergand said in How to always fix the button to the right side using QtDesigner?:
@_jao_victor_
Put the bottom bar and the button in a horizontal layout.Then if you want the button on the right, I can't remember whether the layout allows you to right align, or put a stretch to the left if not.
-
@JonB said in How to always fix the button to the right side using QtDesigner?:
I can't remember whether the layout allows you to right align,
Yes you can.
Now, this bottom bar ressembles very much to a QStatusBar in a QMainWindow and you can add any widget to it with:
addPermanentWidget(QWidget *widget, int stretch = 0) -
now the button is central
-
@_jao_victor_
Right-click on the button and choose :
Layout Alignment->Right -
This post is deleted!