Results 1 to 2 of 2

Thread: How to set style sheet for stackwidget

  1. #1
    Join Date
    Jan 2013
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to set style sheet for stackwidget

    In my Application, i have one stackedwidget, in the first page , i have table widget.
    i want set style sheet for tablewidget headerview,
    but, i can't able to set the qstackedwidget style sheet.

    i have tried as follows,

    this->setStyleSheet( " QHeaderView::section {"
    " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
    " stop:0 #616161, stop: 0.5 #505050,"
    " stop: 0.6 #434343, stop:1 #656565);"
    " color: white;"
    " padding-left: 4px;"
    " border: 1px solid #6c6c6c;"
    "}"
    );


    this->setStyleSheet( " QStackedWidget QWidget#page {"
    "QHeaderView::section {"
    " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
    " stop:0 #616161, stop: 0.5 #505050,"
    " stop: 0.6 #434343, stop:1 #656565);"
    " color: white;"
    " padding-left: 4px;"
    " border: 1px solid #6c6c6c;"
    "}"
    "}"
    );

  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: How to set style sheet for stackwidget

    Use any one of the following

    Qt Code:
    1. this->setStyleSheet( " QTableWidget#tableWidget"
    2. "QHeaderView::section {"
    3. " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
    4. " stop:0 #616161, stop: 0.5 #505050,"
    5. " stop: 0.6 #434343, stop:1 #656565);"
    6. " color: white;"
    7. " padding-left: 4px;"
    8. " border: 1px solid #6c6c6c;"
    9. "}"
    10. );
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. this->setStyleSheet( " QWidget#page"
    2. "QHeaderView::section {"
    3. " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
    4. " stop:0 #616161, stop: 0.5 #505050,"
    5. " stop: 0.6 #434343, stop:1 #656565);"
    6. " color: white;"
    7. " padding-left: 4px;"
    8. " border: 1px solid #6c6c6c;"
    9. "}"
    10. );
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. this->setStyleSheet( " QStackedWidget#stackedWidget"
    2. "QHeaderView::section {"
    3. " background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
    4. " stop:0 #616161, stop: 0.5 #505050,"
    5. " stop: 0.6 #434343, stop:1 #656565);"
    6. " color: white;"
    7. " padding-left: 4px;"
    8. " border: 1px solid #6c6c6c;"
    9. "}"
    10. );
    To copy to clipboard, switch view to plain text mode 
    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. Style Sheet Question
    By zgulser in forum Newbie
    Replies: 2
    Last Post: 9th May 2012, 07:22
  2. Problems with Gradient style used through Style sheet on ARM platform
    By puneet.narsapur in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th January 2010, 12:48
  3. Inherited Style Sheet
    By johnmauer in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2010, 21:07
  4. Slider Style sheet
    By sijithjames in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2009, 12:43
  5. How to use style sheet
    By safknw in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2006, 13: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.