Results 1 to 2 of 2

Thread: QSS and namespaces

  1. #1
    Join Date
    Jul 2013
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QSS and namespaces

    Hi.

    I try to customize some widget that contains in a namespace. I use the QSS. But it doesn't work.

    Qt Code:
    1. class SomeWidget
    2. :public QWidget
    3. {
    4. public:
    5. class TargetToCustomize;
    6. .................................
    7. };
    8.  
    9. class SomeWidget::TargetToCustomize
    10. : public QWidget
    11. {
    12. ................................
    13. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. SomeWidget
    2. {
    3. background: green;
    4. }
    5.  
    6. SomeWidget-TargetToCustomize
    7. {
    8. background: red;
    9. };
    To copy to clipboard, switch view to plain text mode 
    it doesn't work for the TargetToCustomize widget.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QSS and namespaces

    Make sure to add Q_OBJECT macros
    Qt Code:
    1. class SomeWidget
    2. :public QWidget
    3. {
    4. Q_OBJECT
    5. public:
    6. class TargetToCustomize;
    7. };
    8.  
    9. class SomeWidget::TargetToCustomize
    10. : public QWidget
    11. {
    12. Q_OBJECT
    13. };
    To copy to clipboard, switch view to plain text mode 

    And the use this stylesheet
    Qt Code:
    1. SomeWidget
    2. {
    3. background: green;
    4. }
    5.  
    6. SomeWidget--TargetToCustomize
    7. {
    8. background: red;
    9. };
    To copy to clipboard, switch view to plain text mode 
    Note the double hypens (--)
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Qt XML and Namespaces
    By ChrisW67 in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2012, 16:56
  2. Namespaces in QtDBus
    By engelhardt in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2011, 09:29
  3. XML Namespaces
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 13th September 2008, 09:00
  4. namespaces and translations
    By gri in forum Qt Programming
    Replies: 3
    Last Post: 30th March 2007, 09:53
  5. problem with namespaces
    By steve918 in forum General Programming
    Replies: 1
    Last Post: 17th September 2006, 16:55

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.