Questions tagged [qpalette]

The QPalette class contains color groups for each widget state.

The QPalette class contains color groups for each widget state.

A palette consists of three color groups: Active, Disabled, and Inactive. All widgets in Qt contain a palette and use their palette to draw themselves. This makes the user interface easily configurable and easier to keep consistent.

The color groups:

  • The Active group is used for the window that has keyboard focus.
  • The Inactive group is used for other windows
  • The Disabled group is used for widgets (not windows) that are disabled for some reason.
34 questions
8
votes
1 answer

Change disabled QIcon tint color

I have an application with a custom theme and the disabled icons are to brightly grayed. I would like to change the disabled icon tint color. Now I know there is a possibility like this: QTableWidgetItem *name = new QTableWidgetItem("test"); QIcon…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
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
4
votes
2 answers

QPalette does not work on sub QWidget

I want to brush my sub widget with QLinerGradient. I have created ui by using QtDesigner. But I can not brush this widget by using this code.(ui.colorBarWidget is normal QWidget was created by QtDesigner.) QPalette palette; QLinearGradient…
Wilmort
  • 294
  • 2
  • 15
3
votes
1 answer

QPalette not changing correctly in Qt6. Changes only visible when window is inactive

I've got a small example of the GUI I'm working on in Qt6, that has a problem switching palette colors (to switch from dark to light theme). When I apply my changes to QPalette to change the text color, they only work when the window is inactive.…
Nat
  • 43
  • 6
3
votes
2 answers

How to change (remove) selection/active color of QListWidget

In my QListWidget, there are some items that have non-default background color, I set them like so inside the custom QListWidget class: item->setBackgroundColor(qcolor); // item is of type QListWidgetItem* Those non-default colors that I set are…
vicrucann
  • 1,703
  • 1
  • 24
  • 34
3
votes
1 answer

PyQt4 QPalette not working

{btn = QtGui.QPushButton('Button', self) palettes = btn.palette() palettes.setColor(btn.backgroundRole(),QtCore.Qt.green) btn.setPalette(palettes) btn.setAutoFillBackground(True)} Using btn.backgroundRole() only provides green…
Freiza
  • 77
  • 1
  • 9
3
votes
2 answers

How to color a PyQt QTabwidget

I have a PyQt main window that contains a QTabWidget. The tab widget contains a few buttons and text boxes. I'd like to color the entire tab background not just the tabs that stick up in the tab bar area. I'm not using style sheets and would prefer…
JohnSantaFe
  • 145
  • 1
  • 3
  • 11
2
votes
2 answers

How to change the QCombobox highlight colour in PyQt

I am having trouble changing the highlight colour of a QCombobox in PyQt. I have managed to change the highlight colour of the actual input box but when the drop down appears it is still blue. The following images shows what is exactly happening.…
Kermit
  • 329
  • 6
  • 19
2
votes
2 answers

How to customize text on Qpushbutton using QPalette?

How to set font, size and color for the Text of QPushButton in Qt5.6.1 using QPalette? As I am curious to know how we can set these properties without using QStyleSheet in Qt. Also how we can set hex code of color in QT. Please suggest any way to do…
Avi
  • 31
  • 2
  • 7
1
vote
0 answers

PyQt6 - QPalette not working correctly with mdiArea windows

I am using QMdiArea to hold a bunch of windows, I want to be able to set the color theme of all the windows based on a list of items found in one of the subwindows. It seems to work fine with PyQt5 but using PyQt6 it changes the color when the user…
Jas
  • 11
  • 3
1
vote
0 answers

How can I access Qt's used border color for use in qtstylesheets widget styling (via QPalette)?

I can use different colors used in a Qt application via QPalette to style widgets via qtstylesheets, e. g. something like background-color: palette(base). However, I didn't find the color used for drawing the border of some widgets like QGroupBox or…
Tobias Leupold
  • 1,512
  • 1
  • 16
  • 41
1
vote
1 answer

Change palette of PyQt5

Am attempting to change the GUI palette from dark to light. from PyQt5.QtGui import * from PyQt5.QtWidgets import* from PyQt5.QtCore import * class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") …
RealRK
  • 315
  • 3
  • 19
1
vote
0 answers

Updating the default color of anchors in a QTextDocument

I think that this issue has to do with a by-design decision (that I believe is somehow wrong), but I prefer to ask here before submitting a possible bug report. I have a QTextEdit that inherits the parent window's palette for its default font…
musicamante
  • 41,230
  • 6
  • 33
  • 58
1
vote
1 answer

Mimic QApplication::palette() based color style behavior

It is very simple: I want to mimic the change in color of an item being disabled without disabling it. Having QTableWidgetItem and QStandardItem items, I am using code like this item->setForeground( enabled ? QApplication::palette().color(…
DrPepperJo
  • 632
  • 1
  • 5
  • 19
1
vote
0 answers

Overriding Qt Stylesheet in QStyledItemDelegate

I have a QTableView that is using a custom QStyledItemDelegate to render each row of the table. A stylesheet is setting the background color of the selected row on the TableView by doing the following: QTableView::item::selected { …
Haus
  • 1,492
  • 7
  • 23
1
2 3