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
1
vote
1 answer

What is the difference between a Primitive, Control and Complex Control widget?

Qt supports custom paint events for drawing of widgets through QStyle. However when using the QStyle you need to specify what type of element you're trying to draw, i.e, if you want a control element you need to paint it by using…
user12388651
  • 179
  • 1
  • 8
1
vote
1 answer

How to know header text width in QStyle?

I have a QTreeView and use ProxyStyle for that. The pic above is just the header. Now I need to draw the up/down arrow (for sorting items) beside header label as in figure. In order to put the arrow in the correct postion I need to know: the left…
songvan
  • 369
  • 5
  • 21
1
vote
1 answer

Why does delegate not recognize the state mouseOver?

I created a delegate and need to recognize mouseOver state to build an effect. But it does not work. When I my table appears, the output is like this When i move the mouse over the table, the output is like this I don't see the state MouseOver.…
gnase
  • 580
  • 2
  • 10
  • 25
1
vote
0 answers

How to determine the height of a QTabBar

I have two different QDockWidgets: One containing some buttons above another main_widget (File explorer), and another containing a QTabWidget. Question: I aim to get the main_widget and the content of the tabs to the same height. How do I do this…
Tim Hoffmann
  • 1,325
  • 9
  • 28
1
vote
2 answers

Turn off themeing of menus in Qt?

I've inherited a Qt project that had themed right-click menus (which look really weird on macOS). I removed the setStyleSheet() call from the QMenu, yet it still highlights only the text instead of the item's background and uses weird font sizes. Is…
uliwitness
  • 8,532
  • 36
  • 58
1
vote
0 answers

Control the position of the icon in a QLineEdit

I've subclassed QStyle to control the aspect of my app. After customizing the aspect of the QLineEdits, I need to add an icon inside the QLineEdit and it has to be clickable by the user. I've seen that I can use the method QLineEdit::addAction to…
PinTxO
  • 61
  • 9
1
vote
2 answers

Dynamically change QStyle at runtime?

I want to tweak the existing style at runtime, specifically QStyle::PM_ToolBarIconSize. Can this be done? As far as I can tell, you can only inherit QStyle and override pixelMetric(). Edit 1: In the specific case of QStyle::PM_ToolBarIconSize, I…
brock
  • 439
  • 1
  • 5
  • 17
1
vote
0 answers

Not able to see pushButton->setIcon(style.standardIcon(QStyle::SP_MessageBoxCritical))

I am using Qt4.8.6 on windows7, I am trying to set QStyle::SP_MessageBoxCritical Icon to the QPushButton as below QPushButton* criticalButt = new QPushButton(this); criticalButt->setIcon(style.standardIcon(QStyle::SP_MessageBoxCritical)); But I am…
NDestiny
  • 1,133
  • 1
  • 12
  • 28
1
vote
1 answer

Style hover and selected colors for arbitrarely chosen QTreeWidgetItems

I have a QTreeWidget and I have a stylesheet applied to it. I would like some of the QTreeWidgetItems to have different hover and selected colors than the rest of the styesheet styled items. I colored the normal state with setData(columnNumber,…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
1
vote
1 answer

How do I use QStyle::SH_ToolTip_WakeUpDelay to set tooltip wake-up time?

It seems QStyle::SH_ToolTip_WakeUpDelay can be used to set tooltip wake-up time. How do I do it in C++ code?
user1899020
  • 13,167
  • 21
  • 79
  • 154
1
vote
1 answer

How to create desktop application using fully customized UI?

Have a look at this figure below, which is a Quick Book Enterprise Solution 2014 Judging by its interface (not its DLL), I don't think you can easily guess with what platform/language does the above application was created. Qt? .NET? Java? It has…
swdev
  • 4,997
  • 8
  • 64
  • 106
1
vote
1 answer

drop shadow effect on QPushButton text

How do I set a drop-shadow effect on a QPushButton text? I could set shadow on the entire QPushButton using QGraphicsDropShadowEffect, I however, am not able to find a way to directly set the effect of text inside the QButton. Edit: I tried the…
DeepBlack
  • 280
  • 4
  • 10
1
vote
2 answers

How to draw control with QStyle and with specified QSS?

I'm trying to draw a checkbox in QStyledItemDelegate. I want checkbox to be drawng not with native look, but with style that specified with qApp->setStyleSheet(). I don't know why, but when I draw control with QStyle::drawPrimitive - it doesn't pick…
Dmitry Sazonov
  • 8,801
  • 1
  • 35
  • 61
1
vote
1 answer

QSpinBox not drawn correctly

I'm currently implementing a custom delegate, in part of which I need a QSpinBox to be drawn in the paint(..) method. void Sy_floatingPointPD::paint( QPainter* painter, const QStyleOptionViewItem& option, …
cmannett85
  • 21,725
  • 8
  • 76
  • 119
0
votes
0 answers

How to determine current border color of QGroupBox?

I am using Qt 6.3 on Windows 11, and I am trying to figure out the current border color of QGroupBox in Fusion style. I have subclassed QProxyStyle as my class GuiStyle, in my MainWindow constructor: ui.setupUi(this); auto guiStyle = new…
Chaitanya
  • 177
  • 2
  • 9