buddy
buddy

Reputation: 861

placing buttons in Qt

Is there a possibility to place my buttons differently then only horizontal or vertical? My buttons are all put vertically in a row. And my sliders are stretched through the whole widget. I want to arange my buttons and sliders differently.

Do you know a tutorial?

P.S.: I am not using the ui-file-approach. I know that it might be better, but i am not getting it.

Upvotes: 1

Views: 90

Answers (2)

Joe
Joe

Reputation: 96

The following link is a tutorial with a short program which uses multiple QLayout objects to position buttons and other controls.

http://doc.trolltech.com/4.7/tutorials-widgets-nestedlayouts.html

Upvotes: 1

stslavik
stslavik

Reputation: 3028

I'm going to try to do this from memory without looking since I only have a minute:

I believe if you create the widget and set its parent to QWidget but don't add it to the parent layout, you'll be able to position it as you like. Now, in this case it's a child of the parent QWidget, but not a member of it's layout. That means it's akin to a floating element in HTML, and will need to be explicitly handled when the application is resized, so be attentive to that.

Upvotes: 1

Related Questions