title: Place QProgressBar text outside
body: <p>On my Windows machine text is displayed to the right of the progress bar.</p>
  <p><a href="https://i.stack.imgur.com/SShyE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SShyE.png" alt="progress bar on windows" /></a></p>
  <p>On my Linux machine text appears in the middle of the progress bar.</p>
  <p><a href="https://i.stack.imgur.com/9FyUI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9FyUI.png" alt="progress bar on Linux with GTK+-based DE" /></a></p>
  <p>If I apply style to progress bar, text appears inside on both systems. How do I get it to appear outside, like in default Windows style?</p>
  <p><a href="https://i.stack.imgur.com/e60pn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e60pn.png" alt="styled progress bar" /></a></p>
  <hr />
  <p>Here's the simplified version of the code I used to play with progress bars:</p>
  <pre><code>MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
  {
      auto widget = new QWidget;
  
      auto layout1 = new QVBoxLayout;
      widget-&gt;setLayout(layout1);
  
      auto layout2 = new  QHBoxLayout;
      auto progressBar = new QProgressBar;
      auto spinBox = new QDoubleSpinBox;
      spinBox-&gt;setRange(0,100);
      spinBox-&gt;setDecimals(1);
      spinBox-&gt;setSingleStep(1);
      progressBar-&gt;setRange(0, 10000);
      connect(spinBox, qOverload&lt;double&gt;(&amp;QDoubleSpinBox::valueChanged), progressBar,
              [spinBox, progressBar]
              {
                  progressBar-&gt;setValue(spinBox-&gt;value() * 100);
                  progressBar-&gt;repaint();
              });
  
      layout2-&gt;addWidget(spinBox);
      layout2-&gt;addWidget(progressBar);
  
      auto textEdit = new QPlainTextEdit;
      auto stylesheet = R&quot;(
  QProgressBar {
     background-color: cyan;
     border-radius: 1px;
     text-align: right;
  }
  
  QProgressBar::chunk {
     background-color: magenta;     
     border-radius: 1px;
  }
  )&quot;;
      textEdit-&gt;setPlainText(stylesheet);
      connect(textEdit, &amp;QPlainTextEdit::textChanged, progressBar,
              [textEdit, progressBar]
              {
                  progressBar-&gt;setStyleSheet(textEdit-&gt;toPlainText());
              });
  
  
      layout1-&gt;addLayout(layout2);
      layout1-&gt;addWidget(textEdit, 1);
  
      setCentralWidget(widget);
  }
  </code></pre>