SIFE
SIFE

Reputation: 5695

Set widget in center in QDesigner

Is it possible to set widget in center of dialog or windows in QDesigner, say I have a widget contain 3 line edits and labels and I want to set this widget in center of window.

Upvotes: 21

Views: 34203

Answers (3)

AndiDog
AndiDog

Reputation: 70108

In latest Qt Designer, right-click a widget in the Object Inspector and choose your preference under Layout Alignment.

Layout Alignment

Upvotes: 36

Sebastian Dusza
Sebastian Dusza

Reputation: 2528

It should be quite simple:

  1. Insert horizontal spacer
  2. Set Horizontal layout
  3. Insert Vertical layout
  4. Insert another horizontal spacer

  5. Add Vertical spacer to Horizontal spacer (drag to widget tree)

  6. Add your widgets .... labels, textedits
  7. Add another vertical sapcer to Horizontal space

Works in my QtCreator, should also in Your Designer :)

Good luck.

Upvotes: 6

Patrice Bernassola
Patrice Bernassola

Reputation: 14416

Add a layout to your windows and add the widgets in the layout. Then you can set the position policy in the properties panel of the layout.

Upvotes: 1

Related Questions