开发者

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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜