Results 1 to 4 of 4

Thread: QFrame and stylesheet

  1. #1
    Join Date
    Jan 2012
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default QFrame and stylesheet

    The main application of my project defines a QFrame item in a stylesheet like this:

    QFrame
    {
    padding: 0px;
    margin: 0px;
    border-style:none;
    }

    I want to overwrite this for a particular class so a line will show up, I tried using:

    MyClass QFrame {}

    ...but no luck. I've wrestled with stylesheet issues before and this bugs me to the nth degree cause everything that should work hasn't worked.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFrame and stylesheet

    Try
    Qt Code:
    1. MyClass {}
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2011
    Location
    Portugal
    Posts
    25
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QFrame and stylesheet

    If your class inherits QFrame, just set an object name in your class constructor for example. Something like this:

    setObjectName("myClassFrame");

    and then, in your stylesheet, do something like this:

    QFrame#myClassFrame {
    /*your qss properties here*/
    }

  4. #4
    Join Date
    Jan 2012
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFrame and stylesheet

    I found a workaround, thanks.

Similar Threads

  1. Control spacing of a QFrame layout using a Stylesheet
    By gmat4321 in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2012, 20:18
  2. QFrame within QScrollArea
    By CSwanepoel in forum Newbie
    Replies: 3
    Last Post: 9th May 2011, 01:19
  3. Using css for all QFrame's except one.
    By babu198649 in forum Newbie
    Replies: 2
    Last Post: 10th July 2008, 09:05
  4. QFrame/QTabWidget stylesheet.
    By fanat9 in forum Qt Programming
    Replies: 2
    Last Post: 2nd December 2007, 23:24
  5. Reg - QFrame
    By suresh in forum Qt Programming
    Replies: 1
    Last Post: 1st November 2006, 05:34

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.