PDA

View Full Version : Qt QSS help



dennis
14th June 2010, 22:28
Hi,

I have like a million of questions regarding Qt but I'm trying to figure out most of them by googling however I'm having problem finding a couple of things:

1) Is it possible to add a vertical alignment to QGridLayout, I'm trying to add a layout like this:
my_label - input
............... - input2

but the my_label will be vertically aligned to the middle.

2) I read that you cant apply styles to subclasses but is it possible to add a style name to your widget (like a class in HTML)? How else would you style specific widgets?

3) I would like to add a settings window to my application with a couple of tabs, should I declare a new QTabWidget and use my_tabs.show() or is there a better to add an external windows.

tbscope
15th June 2010, 05:36
1) Is it possible to add a vertical alignment to QGridLayout, I'm trying to add a layout like this:
my_label - input
............... - input2

but the my_label will be vertically aligned to the middle.

If you don't want to allign the lable in the midle, you want to use a vertical spacer below the lable.


2) I read that you cant apply styles to subclasses but is it possible to add a style name to your widget (like a class in HTML)? How else would you style specific widgets?
Both a QStyle subclass and stylesheets are able to style individual widgets based on their properties. Example, if you have a button with the name "destroy", you can then use the name to set the background to red for example.


3) I would like to add a settings window to my application with a couple of tabs, should I declare a new QTabWidget and use my_tabs.show() or is there a better to add an external windows.
You can but you should always try to create a dialog and add the widgets to the dialog because a dialog lets you handle modality.

dennis
15th June 2010, 18:49
1) How do you use the vertical spacer? This is what i got so far, my previous illustration didn't show the problem so good.

http://farm5.static.flickr.com/4059/4703312649_dd00701fda_b.jpg

3) What do you mean with handling modality? :confused:

So I would want to use QDialog -> QTabWidget -> and then QWidget for the actual form?