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
12
votes
4 answers

Qt: Styling QTabWidget

I'm using Qt and I have a QTabWidget setup in the Qt Designer Editor, you can see it in picture 1. As you can see after Tab4 there is an empty space all the way to the right edge, in someway I need to fill that space with a color, like in picture…
Martin
  • 1,675
  • 11
  • 34
  • 46
11
votes
2 answers

How to change color of QMainWindow borders and title bar?

The QMainWindow below is assigned a dark-gray background-color using QSS. I would also like to change the color of the borders and the color of the title bar. How to achieve control of the appearance of the QMainWindow borders and titlebar? I would…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
11
votes
1 answer

Is it possible to specify more than just "regular" and "bold" versions of a font in a Qt Stylesheet?

I have a font that has several font weights within one family (extra light, light, regular, semibold, bold, black). For this example, I'm using the free Google Webfont Source Sans Pro, but I've had the same issue with any font that has multiple…
ScottG
  • 773
  • 6
  • 18
10
votes
1 answer

Updating ObjectName of widget does not not update the style automatically

In my application, the stylesheet for the entire application is taken from a resource file loaded into the application. I have two stylesheets defined there for a QListWidget: QListWidget#Good{ ..some color properties } QListWidget#Bad { ..soem…
JasonGenX
  • 4,952
  • 27
  • 106
  • 198
10
votes
2 answers

Is it possible to change the color of a QSlider's handle according to its position?

I pretty well understood how to customize a QSlider through style sheets, but I am wondering if it is possible to do the following thing:                                                I'd like the handle of the slider to go from blue to yellow.…
IAmInPLS
  • 4,051
  • 4
  • 24
  • 57
10
votes
2 answers

How to prevent the default blue border being drawn on QLineEdit focus

I am trying to achieve a borderless QLineEdit through CSS. It works fine when the QLineEdit is not in focus but when in focus the default blue border always comes up. The simple CSS I am using: QLineEdit, QLineEdit:focus { border: none; } I have…
Soumya Das
  • 1,635
  • 2
  • 19
  • 28
10
votes
3 answers

QComboBox AbstractItemView::item

Is there a way I could increase the height of the items, which are listed in a QComboBox control ? I tried following as suggested here in QTDevNet forums but with no luck QComboBox QAbstractItemView::item {margin-top: 3px;} I also tried this, still…
warunanc
  • 2,221
  • 1
  • 23
  • 40
10
votes
5 answers

Tab close button position

I want to style my tabs in my Qt app as follows: I used following style sheet: QTabBar{background-color: #fff; border-top: 0px;} QTabBar::tab { border-image: url(:/New_UI/tab_inactive.png) 7 17 7 2; margin-left: 2px; border-right:…
warunanc
  • 2,221
  • 1
  • 23
  • 40
9
votes
1 answer

Adjust title position in a QGroupBox (using style sheets)

I am trying to style a QGroupBox to match certain design requirements: Note - the group title on top should be on the left but past the box curvature. With the following style sheet, I get the images below (second image if I remove the word…
Thalia
  • 13,637
  • 22
  • 96
  • 190
9
votes
2 answers

Flat QPushButton, background-color doesn't work

I created QPushButton in Qt Designer with this stylesheet: QPushButton#pushButton { background-color: #ffffff; } QPushButton#pushButton:disabled { background-color: yellow; } QPushButton#pushButton:pressed { background-color: orange;…
tomsk
  • 967
  • 2
  • 13
  • 29
9
votes
3 answers

QComboBox text colour won't change with style sheet

I'm trying to style a combobox in QT5. I'm using QT Creator for the layout and loading an app-wide style sheet at start up. The css I have related to my combobox is as follows: QComboBox { color:white; background-color: qlineargradient(x1:0,…
Sam
  • 374
  • 1
  • 3
  • 14
9
votes
1 answer

QWidget does not draw background color

I am using PySide 1.2.1 with Python 2.7 and I need a widget to draw a colored background. In Qt Designer I created a simple window consisting of a label, a widget containing three other items and another label. For the widget containing the button,…
Robert
  • 227
  • 1
  • 3
  • 9
8
votes
4 answers

Qt Stylesheets: How to apply style to menus? How to remove blue tinge around QTextEdit?

I am trying to make the menubar a gradient black colour and that works fine, except for the menu headings. Here's the stylesheet i'm using: QString styleSheet = "QMenuBar{background: qlineargradient(x1:0,x2:0,y1:0,y2:1,stop:0 #cccccc, stop:0.4…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
8
votes
2 answers

Qt 4: How to set outer border for QWidget so that its inner widgets are unaffected?

I have quite a strange problem. I have a QWidget with QHBoxLayout on it. The layout contains two QLabels. I want to set a border for this whole widget. I'm using style sheet: "padding: 10px;" "border-style: solid;" "border-width: 3px;" …
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
8
votes
2 answers

Qt: change font weight

I would like to have my text in QLabel somewhere between bold and normal style and I believe that setting font-weight should be the answer to my problem. In Qt documentation, I have found out that there are two options how to change…
Martin Cmar
  • 83
  • 1
  • 1
  • 5
1
2
3
51 52