Questions tagged [qstyle]

QStyle is an abstract base class that is responsible for the look and feel of the GUI.

Qt has a set of classes subclassed from QStyle that represent native GUI styles for platforms that Qt supports.

Qt's widgets use QStyle to perform their drawing. Note that when subclassing, a developer should use QCommonStyle rather than QStyle as a base class.

The official documentation can be found here for Qt 4 and here for Qt 5.

64 questions
2
votes
1 answer

How to "Re-Polish" QApplication with Same Style?

Upon my qt5 application's initialization, the QApplication instance is provided with a custom style class that inherits from QProxyStyle. This class overwrites the void polish(QPalette &palette) function in order to change the general color scheme…
Griffort
  • 1,174
  • 1
  • 10
  • 26
2
votes
1 answer

How to make QT application use native Windows cursors instead of qt specific?

In my application I want to have native Windows cursors icons instead of loaded/built from qt resources. For example Qt::SplitVCursor/Qt::SplitHCursor which differs from standard Windows.
2
votes
1 answer

How to modify style hint without QProxyStyle?

I use Python bindings of Qt (PySide or PyQt4). They don't have QProxyStyle. I want to change the value of a style hint. For example change the SH_Menu_SubMenuPopupDelay popup delay time of a submenu. In native C++ Qt I would use a QProxyStyle and…
NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
2
votes
1 answer

Use Clipping in Qt

Is it possible to use clipping in an widgets painEvent, if the widget is using stylesheets? The background and reason for my question is that I want to make the widget animating when it appears and disappears. (Something like a resizing circle or…
exilit
  • 1,156
  • 11
  • 23
2
votes
2 answers

Where does QMessageBox get its styleguide, font-size, ... from?

I implemented a custom QMessageBox, inherited from QDialog. (Using qt 4.8.6) The problem is now that all the custom messageboxes look totally different from the QMessageBox static functions: QMessageBox::information(...)…
user1911091
  • 1,219
  • 2
  • 14
  • 32
2
votes
3 answers

Qt::How to lower the text in a QSpinBox

I'm using a spinbox with a custom font which looks too high in the spinbox. How do I move the text lower? I have already reimplemented QStyle and made the font lower in another widget but I can't find where to do it with the spinbox. There must be a…
Ayeayeron
  • 439
  • 5
  • 19
2
votes
3 answers

Change icon on state change using Qt stylesheet

I'm trying to support theming for my application, and I'm coming across a problem where I have to change icons based on the state of the QPushButton (default, hover, pressed, etc.). Here is what I use to set the icon for a…
Spen-ZAR
  • 818
  • 6
  • 19
2
votes
2 answers

Disabled QGroupBox title shadow (aka etching)

Look thoroughly at the disabled QGroupBox title (see attached image). You'll notice a tiny white 1-pixel shadow under the title's letters. It's barely noticeable on default style sheet, but it can be much more annoying if you set dark background…
Vasily
  • 235
  • 3
  • 14
1
vote
0 answers

In Qt source, where to find the code for drawing controls on default Mac OS style?

I know QCommonStyle inherits QStyle, and QWindowsStyle inherits QCommonStyle, and QWindowsXPStyle inherits QWindowsStyle. If my application has a control (for example QSlider) and I debug it on Windows XP, then I can set a breakpoint on…
Royt
  • 199
  • 4
  • 14
1
vote
1 answer

Is it possible to re-style a QProgressBar on OS X?

The approach using a QStyle Subclass, and setting the palette doesn't work (but does work for other base styles to MyStyle). void MyStyle::drawControl(ControlElement control, const QStyleOption *option, QPainter *painter,…
James
  • 24,676
  • 13
  • 84
  • 130
1
vote
1 answer

HowTo draw QTreeWidgetItem with different style?

Here is the main problem: I'm using QTreeWidget class as a main tree, which must show me this tree structure: [Today] [Row1] [Row2] [SubRow21] [SubRow22] [Row3] [Yesterday] [Row4] [SubRow41] [etc] With Qt Designer I…
mosg
  • 12,041
  • 12
  • 65
  • 87
1
vote
1 answer

Qt Windows: Rounded ToolTips

I need rounded tooltips in Qt5 + Windows. Rounded corners for tooltips cannot be set via stylesheet, the following stylesheet is not working: QToolTip { font-family: Calibri; font-size: 13pt; border-radius: 0.5em; ... } I cannot…
Vladimir Bershov
  • 2,701
  • 2
  • 21
  • 51
1
vote
0 answers

How to get more PySide6 styles in pip virtual environment?

I am making a program in PySide6 and have a pip venv setup, but this way QStyleFactory.keys() shows only "Windows" and "Fusion" styles. Is there any way to get more themes, or set the style to the system's qt6 theme? I'm running on Arch and followed…
Marcus Hagberg
  • 175
  • 1
  • 11
1
vote
0 answers

What's the difference between polish()/unpolish() and update()?

I did research on all of them. I saw that docs use just unpolish() and polish(), but stackoverflows answers use them with update(). I tried and polish() without unpolish() and update() and it works. So what's the diffrence? Using only polish() is…
nebo
  • 19
  • 1
1
vote
1 answer

Qt: Style depending on label value

I have what looks like a very simple problem: I want to design a QLabel whose value changes dynamically (no issue here) and whose background color changes accordingly (this is the issue). Of course, I know I can do something like that (pseudo…
Silverspur
  • 891
  • 1
  • 12
  • 33