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
0
votes
0 answers

Pyqt6: How to style a Tabwidget to be a vertical tab with horizontal text alignment with a checkbox?

I used this question/answer (pyqt5 tabwidget vertical tab horizontal text alignment left) to position the tabs vertically and text horizontal but I am unable to move the tabButton (QCheckBox) that I am adding from the center of the text. class…
Sean O
  • 302
  • 1
  • 9
0
votes
0 answers

QPainter paints under the widget's background color (background defined in styleSheet)

I want to draw a line on top of the widget, but visually QPainter draws it under the widget if the widget has background color. Paint event function in which I'm trying to draw the line: void PaintHelper::paintEvent(QPaintEvent *event) { …
0
votes
1 answer

How do I check StyleOption state in Pyside6?

So I'm trying to determine what or how can I determine particular state of StyleOption. I used the '==' operator but building a QPushbutton it seems like it returns sometimes True and sometimes False for a particular metric. Main.py import sys from…
0
votes
2 answers

PyQt5 How to apply different QStyles to different widgets?

I am trying to make multiple widgets with different styles from the built in styles provided by QStyleFactory, but when I run my code they all look the same. How can I fix this? from PyQt5 import QtWidgets, QtCore, QtGui import sys class…
pyjamas
  • 4,608
  • 5
  • 38
  • 70
0
votes
1 answer

How to create a custom TreeView in qt with branches put at right side of the ItemView?

What I want is to create a sidebar with qt with QTreeView that branches are put at right side of items. Like AdminLTE sidebar: https://adminlte.io/themes/AdminLTE/index2.html#. I have Tried several solutions each failing my desired design: Using…
Armin Fisher
  • 134
  • 5
0
votes
0 answers

With Qt is it possible to create a windows 10 apllication which has GTK style?

I'm migrating a python 2 and GTK 2 application to Qt and python 3 on Windows 10. I've converted .glade files to .ui files and dialogs initially look bad as the layout was designed for a gtk style and are jarring with windows 10 style but not…
ayeayeron
  • 1
  • 1
0
votes
1 answer

Using drawComplexControl to retrieve QSliderHandle image

Today I was trying to take a picture of the QSlider handle in order to use it in an adpated QSlider widget with two handles. This is somewhat similar to the following question: Range slider in Qt (two handles in a QSlider) For a full fledged…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
0
votes
1 answer

PyQT Fusion style removes checkboxes in checkable combobox

I created a checkable qcombobox using the following code. Then, I applied the fusion style to make my program look better. However, doing so results in the checkboxes next to the items in my code to no longer be visible. How can I fix that? class…
Osama Adel
  • 73
  • 1
  • 6
0
votes
1 answer

Qt - style characters from index x to the end

How to style characters from index x (eg. x=10) to end of text in QLineEdit? Example: Text in QLineEdit: 0123456789 And I want make characters from index 2 (that is 2) to the end should be bold. 0123456789
Guruku
  • 653
  • 1
  • 7
  • 6
0
votes
0 answers

How to figure out the default item view row height?

For a reason I have not yet realized, the out-of-the-box QTableView has row height about twice as large as QTreeView or QListView, at least on my system. I'm trying to figure out the default value Qt is supposed to have for this element type; sadly,…
sigil
  • 815
  • 8
  • 16
0
votes
1 answer

QProxyStyle align QTreeView header with branch

I'm creating a QProxyStlye and would like to align the first header column with the items in the column. Normally the first column starts with (0,0) and the items is offset by the width of a possible branch indicator (red square in the image).
TheOneRing
  • 83
  • 1
  • 5
0
votes
1 answer

Transient scrollbar in Qt

I want to use transient scrollbar (Transient scroll bars appear when the content is scrolled and disappear when they are no longer needed) in Qt application. For this purpose I have inheritanced class QproxyStyle and reimplemented function…
scopichmu
  • 135
  • 11
0
votes
1 answer

How to add checkbox in the bottom left corner of QGraphicsView?

I want to add a checkbox in the left corner of QGraphicsView . I tried painting it directly in painEvent of my view . void BhGraphicsView::paintEvent(QPaintEvent* event) { QGraphicsView::paintEvent(event); QStyleOptionButton opt; …
uchar
  • 2,552
  • 4
  • 29
  • 50
0
votes
0 answers

QCheckBox indicator size is wrong after stylesheet was applied

I created an own checkbox class from QCheckBox class. In my implementation I use size of checkbox indicator and checkbox label spacing for my internal algorithms. I get sizes like this: // Checkbox indicator…
Mykola Niemtsov
  • 540
  • 1
  • 7
  • 23
0
votes
1 answer

Drawing QPushButton text off the button

I am creating a custom QPushButton. If the button has an icon I want the icon centered on the button. If the button has text I want the text centered on the button. I can handle both of those cases. If the button contains both an icon and text I…