Questions tagged [qtstylesheets]

For questions relating to Qt Style Sheets, which allow declarative customization of Qt objects.

Qt Style Sheets enable customization of the appearance of widgets, in addition to what is possible by subclassing QStyle. The concepts, terminology, and syntax of Qt Style Sheets are heavily inspired by HTML Cascading Style Sheets (CSS) but adapted to the world of widgets, and supporting features considered as valid for the CSS 2.1 specification only.

769 questions
8
votes
2 answers

Determining Qt stylesheet options programmatically?

Is it possible to look up stylesheet values at runtime in Qt? I'm working on a custom button derived from QPushButton that has some stylesheet properties set. I'd like to be able to look up some stylesheet settings like border width, margin,…
Grant Limberg
  • 20,913
  • 11
  • 63
  • 84
8
votes
1 answer

How to use a embedded font in Qt Style Sheet?

I added a font name ":font/Oswald-Regular.ttf" in my .qrc resource file. I would like to use it in my Qt Style Sheet for all QLabels. This is the code for Arial : QLabel { color: white; font: 10pt "Arial"; }
John Smith
  • 771
  • 4
  • 11
  • 25
8
votes
2 answers

Set border for QSpinBox when focused

For already existed Qt project I'd like set border for focused widgets through qss-fle. But I faced out with some unexpected result. When I change border of QSpinBox (and QDoubleSpinBox) border will change as I expect but up-button and down-button…
Gluttton
  • 5,739
  • 3
  • 31
  • 58
8
votes
1 answer

Change disabled QIcon tint color

I have an application with a custom theme and the disabled icons are to brightly grayed. I would like to change the disabled icon tint color. Now I know there is a possibility like this: QTableWidgetItem *name = new QTableWidgetItem("test"); QIcon…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
8
votes
5 answers

QComboBox style for choosen item in drop-down list

I want to style the highlighting of chosen item in drop-down of combobox. The difference to other questions is that I do not want to style "selected" item (hovered over), but to style the already chosen item. The default is some sort of tick which…
nayana
  • 3,787
  • 3
  • 20
  • 51
8
votes
3 answers

How to change QPushButton icon using stylesheets?

Is it possible to set and change the icon on a QPushButton using stylesheets? I need this for a Windows-based white-label Qt4.5 application that customers stylize using stylesheets.
Robin
  • 695
  • 2
  • 8
  • 23
8
votes
1 answer

styling text regions with class selector from global QSS

How can I style a span that is part of a widget text (e.g. a QLabel) via global style sheet? E.g. in below example, both foo and bar should be red. #include #include class some_label : public QLabel { …
Philipp Gesang
  • 496
  • 1
  • 6
  • 16
8
votes
2 answers

How to move a Qt stylesheet to an external file but keep it compiled in resources?

My Qt application has a large stylesheet with lots of margins, pixels and other stuff directly based on and related to drawing and graphics. I would be happy to give all that stuff to the designer, but the stylesheet is kept within the .ui file…
Alexander Dunaev
  • 980
  • 1
  • 15
  • 40
8
votes
2 answers

Qt global style sheet loading?

How can I load a style sheet (.qss style resource) globally with Qt? I am trying to make things a bit more efficient than: middleIntText -> setStyleSheet("QLineEdit { border: 1px solid gray; border-radius:…
Brandon Clark
  • 788
  • 1
  • 13
  • 26
7
votes
0 answers

Using high DPI images with QtStyleSheet

I have a Qt Widgets application using Qt styleSheet for the app look and feel. We want to add support for high-DPI displays, as on these, the app looks very small. The first step was thus to…
majk
  • 827
  • 5
  • 12
7
votes
2 answers

Apply stylesheet to HTML content in QTextEdit

I have a QTextEdit where I do display some HTML. Could I apply a stylesheet to that very HTML content? Do not confuse it with applying a Qt stylesheet to the QTextEdit (that I know). I want to change the appearance of what is in the QTextEdit widget…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
7
votes
2 answers

Remove blue selection from QTreeView in "fusion" style

I have a QTreeView with a stylesheet defining the selection. However, when I use the "fusion" style, there is an additional blue selection rectangle over the decoration: I've tried using show-decoration-selected: 0; in the style sheet, as well as…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
7
votes
1 answer

Padding between QMainWindow and contained widgets

I'm trying to increase padding between widgets contained within a QMainWidget and the edges of the QMainWidget. You can see the problem in the image below: There is no padding between QTabWidget (which is central widget of the QMainWidget) and the…
ezpresso
  • 7,896
  • 13
  • 62
  • 94
7
votes
1 answer

How to set a different background-color to a disabled button with QSS?

I have already tried to use disabled and !enabled but it doesn't work. Here is my QSS code : QPushButton { background-color:#44c767; border-radius:5px; border:1px solid #18ab29; color:#ffffff; font-family:arial; …
Jan Moritz
  • 2,145
  • 4
  • 23
  • 33
7
votes
2 answers

changing stylesheet dynamically

I'm trying to change the style of my QLabel using a dynamic property since we can target this property in QSS like this: QLabel[foo = "warning"]{ color: red; } QLabel[foo = "success"]{ color: green; } the stye of my label does update when I use the…
Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99
1 2
3
51 52