Results 1 to 2 of 2

Thread: style sheets

  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Thanks
    29
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default style sheets

    hello all,
    what's wrong here .. ?
    Qt Code:
    1. btnOnOff = new QPushButton("start/stop");
    2. btnOnOff->setCheckable(true);
    3. qApp->setStyleSheet("#btnOnOff{color:green}");//this has no effect
    4. qApp->setStyleSheet("QPushButton{color:green}");//this colours all QPushButtons (as excpected
    To copy to clipboard, switch view to plain text mode 

    I may have missed something silly. Why is the first setStyleSheet() ignored? Do I have to tell sombody about the name 'btnOnOff?

    thanks
    K

  2. #2
    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: style sheets

    Sure you do.
    Qt Code:
    1. btnOnOff->setObjectName("btnOnOff");
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to wysota for this useful post:

    TheKedge (30th March 2007)

Similar Threads

  1. Setting a Style Issue
    By forrestfsu in forum Qt Programming
    Replies: 5
    Last Post: 28th March 2007, 21:32
  2. about scrollbar style
    By qtopiahooo in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2007, 13:34
  3. Qt Style Sheets Problems with QDialog
    By Lykurg in forum Qt Programming
    Replies: 3
    Last Post: 5th November 2006, 14:43
  4. Custom Style
    By Dusdan in forum Qt Tools
    Replies: 8
    Last Post: 1st September 2006, 22:50
  5. Bugs, style changes in 4.1.0?
    By simk in forum Qt Programming
    Replies: 13
    Last Post: 13th February 2006, 11:05

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.