PDA

View Full Version : Qstylesheet properties



isisbinder
5th September 2013, 18:58
I'm learning Qt and my last move was to put all the (supported) styling stuff in qss files. I have this class (python):



class MainWindow(QtGui.QMainWindow):

def __init__(self, desktop):
super(MainWindow, self).__init__()


Searching on the qstylesheet syntax page I found that it's possible to set some properties using qss files. Then, i did this:



QMainWindow {
qproperty-maximized: true;
}

But I get the following message: cannot design property named "maximized"

I guess this occurs because the docs state that it's a const value, but then... Are there any means of setting the main window as maximized using qss files? Do I have to modify the element selector to deal with property inheritance from QWidget?

ChrisW67
6th September 2013, 00:26
Where is your supposed QSS property name documented? Your question is currently the only hit on Google for that property name.

AFIAK there's no way for a style sheet to control the window manager's placement of the top level widget. Use QWidget::showMaximized() to suggest that to the window manager.

wysota
6th September 2013, 09:52
AFIAK there's no way for a style sheet to control the window manager's placement of the top level widget. Use QWidget::showMaximized() to suggest that to the window manager.

In theory one could add such a property, program it and then style it using the syntax for setting Qt property values. "maximized" is a read-only property and that's why the syntax does not work here.