Results 1 to 3 of 3

Thread: Qstylesheet properties

  1. #1
    Join Date
    Sep 2013
    Posts
    1
    Qt products
    Platforms
    Unix/X11 Windows

    Default Qstylesheet properties

    I'm learning Qt and my last move was to put all the (supported) styling stuff in qss files. I have this class (python):

    Qt Code:
    1. class MainWindow(QtGui.QMainWindow):
    2.  
    3. def __init__(self, desktop):
    4. super(MainWindow, self).__init__()
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. qproperty-maximized: true;
    2. }
    To copy to clipboard, switch view to plain text mode 

    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?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qstylesheet properties

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qstylesheet properties

    Quote Originally Posted by ChrisW67 View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QPushButton hightlight effect with QStyleSheet
    By franki in forum Qt Programming
    Replies: 0
    Last Post: 23rd September 2012, 16:19
  2. about properties
    By jajdoo in forum Newbie
    Replies: 5
    Last Post: 21st July 2011, 14:15
  3. QStyleSheet font-size as percentage?
    By dhalbert in forum Qt Programming
    Replies: 1
    Last Post: 26th June 2010, 06:00
  4. QStyleSheet vs QML
    By Guilo in forum Newbie
    Replies: 3
    Last Post: 10th June 2010, 11:46
  5. Force redraw of QSimpleRichText when QStyleSheet changes
    By SHesselbarth in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2006, 16:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.