Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Style QProgressBar when the value is 16
Forum Updated to NodeBB v4.3 + New Features

Style QProgressBar when the value is 16

Scheduled Pinned Locked Moved Solved General and Desktop
qssqprogressbar
4 Posts 3 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brcontainer
    wrote on 7 Apr 2015, 19:20 last edited by A Former User
    #1

    It is possible to style the QProgressBar using only QSS when the value is 16 for example?

    If I set 16 in value

    ui->progresso->setValue(16);
    

    Use a QSS like this:

    QProgressBar {
        //Default QSS
        ...
    }
    
    QProgressBar:value(16) {
        background-color: #fc0;
    }
    

    QT project: https://github.com/brcontainer/qt-helper

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maximus
      wrote on 7 Apr 2015, 20:38 last edited by
      #2

      You can set the stylesheet in the cpp code when the condition is met, so this is possible

      Example:

        if (condition) {
           ui->pushButton_expand->setStyleSheet("QPushButton#pushButton_expand{image: url(:/image/icon/exp1);border-radius: 1px;}");
       }
       else {
          //revert to default stylesheet
       }
      

      Free Indoor Cycling Software - https://maximumtrainer.com

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 7 Apr 2015, 21:04 last edited by
        #3

        Hi,

        You can use visualRect to check whether the item is visible.

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brcontainer
          wrote on 8 Apr 2015, 22:23 last edited by
          #4

          Thanks :)

          QSS don't support this? :(

          QT project: https://github.com/brcontainer/qt-helper

          1 Reply Last reply
          0

          4/4

          8 Apr 2015, 22:23

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved