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
46
votes
6 answers

Dark theme for Qt widgets?

Background I'm building a PyQt5 application, that I'd like to have a dark theme for. Previously I've worked with Android development where there was a dark theme that I could set for a whole application Question Is there a dark theme built into Qt…
sunyata
  • 1,843
  • 5
  • 27
  • 41
8
votes
1 answer

qlineargradient horizontal & vertical

i'm trying to generate a clickable HVS colorspace widget using QGraphicsView. The background of the whole QGraphicsView shall look like the image below (without jpeg-artefacts). Clicking at position x,y shall give the color under the cursor. I…
xam
  • 155
  • 1
  • 8
8
votes
2 answers

How to render a red push button using QStyle.drawControl()?

With the following code I tried to render a red push button using QStyle.drawControl(): #include #include class Widget : public QWidget { virtual void paintEvent(QPaintEvent* event) { QStyleOptionButton…
Johan Råde
  • 20,480
  • 21
  • 73
  • 110
6
votes
1 answer

How to set QPalette back to default system palette?

I start my application initially in a dark color theme according to this example. I would like to make possible for users, to switch back to their current default system color profiles of their operating system (as I start that application without…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
6
votes
2 answers

How to paint correct text color in QStyledItemDelegate

I'd like to draw a custom item delegate, which follows the current style. But there are differences between "WindowsVista/7" style and "WindowsClassic" for text color. Im using the following code for drawing the background (working): void…
Schlumpf
  • 311
  • 4
  • 12
5
votes
2 answers

How does Qt select a default style?

In a Qt GUI application, QApplication::style()->objectName() will return the current style, for example "windowsvista". How/where does it choose this default style, and what information does it use to decide?
OJW
  • 4,514
  • 6
  • 40
  • 48
5
votes
1 answer

Where to save the state of QWidget animations for use in QStyle draw functions?

A QWidget as a paintEvent function which is responsible of his drawing. To implement correctly this function, a QStyle object is used to represent each component and a QStyleOption object to save the status of the control. E.g: A custom ScrollBar…
Adrian Maire
  • 14,354
  • 9
  • 45
  • 85
5
votes
1 answer

Setting style in using QStyleFactory from a list of styles in a QComboBox

I've been implementing an application using PyQt4. In this application I want to set the style according to the user's choice, and I want to set the style without restarting the dialog again. Here's my piece of code which is affecting the styling…
dragfire
  • 435
  • 1
  • 7
  • 20
4
votes
2 answers

QToolButton with icon + text: How to center both?

I am using multiple QToolButtons in a custom QGridLayout widget. The buttons are set to display icon + text based on an assigned default QAction. The only issue is that the content (icon + text) is always left-aligned. The content (icon + text,…
Philip Allgaier
  • 3,505
  • 2
  • 26
  • 53
3
votes
1 answer

Should I fetch standard icons from QFileIconProvider or QStyle?

Both classes offer standard icons for folders and files. Which one should I use? Are they guaranteed to be the same?
sigil
  • 815
  • 8
  • 16
3
votes
1 answer

Application Window Style

Though my operating system is Windows, I want my application to look like a Mac application. I know I can easily change that style using QApplication::setStyle. QApplication::setStyle(new QWindowsVistaStyle) I know Qt provide MacStyle too so, for…
user3734823
  • 99
  • 1
  • 1
  • 10
2
votes
1 answer

drawControl not receiving correct QStyleOption

I'm trying to style my application though a QProxyStyle. I create a StyleCustom class which override drawControl to draw my tabs in red or green depending on the tab state, and add the text on top of it. However, using option.text gives me the…
Kusefiru
  • 130
  • 7
2
votes
1 answer

PyQt5 Fusion Style Button Icons are broken

I want a toggle button to show different images depending on the toggled state. The feature works fine in the default QApplication Style ('WindowsVista'). But WindowsVista style is ugly and I'd rather use Fusion style. Unfortunately, the image does…
bfris
  • 5,272
  • 1
  • 20
  • 37
2
votes
0 answers

Is it possible to remove window icon using QStyle in Qt?

QStyle is a very flexible tool that helps customize your widgets. But how can I remove that icon using QStyle?
2
votes
1 answer

Drawing QTreeView items with QStyledItemDelegate

I have created a project based on the Simple Tree Model Example from the Qt examples list and edited its model so that some items can also be checked; this is how it looks like: I would like some of the items to be slightly moved to the left. So I…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
1
2 3 4 5