October 26, 2011

andyc andyc
Lab Rat
5 posts

How to align pushbutton

 

Hello, how i can i allign my pushbutton in the centre of the mainwindow ? ive been googling for a while, and didnt find any answer…
also, i would like to have my button in the centre of the window even if the window is resized…

Best regards,
OSiRiS

5 replies

October 26, 2011

RazrFalcon RazrFalcon
Lab Rat
114 posts

Add QPushButton to main widget in designer and press Ctrl+G.
It’s the simplest way.

 Signature 

QT != Qt
Gentoo + KDE

October 26, 2011

andyc andyc
Lab Rat
5 posts

Sorry, this does not solve anything

it just stretches the button, so its as wide as mainwindow, and the button“s geometry is disabled, so i cant move it any further

October 26, 2011

RazrFalcon RazrFalcon
Lab Rat
114 posts

But now it’s…

andyc wrote:
in the centre of the window even if the window is resized

also, you can set “Horizontal Policy” property to “Fixed”

 Signature 

QT != Qt
Gentoo + KDE

October 26, 2011

cincirin cincirin
Ant Farmer
388 posts

See How to center a window on the screen [developer.qt.nokia.com]
But instead of desktop available geometry, use button parent geometry.

October 26, 2011

peppe peppe
Ant Farmer
1026 posts

andyc wrote:
Hello, how i can i allign my pushbutton in the centre of the mainwindow ? ive been googling for a while, and didnt find any answer…
also, i would like to have my button in the centre of the window even if the window is resized…

Best regards,
OSiRiS

Do you mean like using a layout? Otherwise, can you elaborate?

 Signature 

Software Engineer
KDAB (UK) Ltd., a KDAB Group company

 
  ‹‹ [SOLVED] How to set the QDir to current open file ?      "Rendering" QGraphicsDropShadowEffect in another thread ? ››

You must log in to post a reply. Not a member yet? Register here!