qtstylesheets

Specific QPushButton style

好久不见. 提交于 2019-12-08 02:41:42
问题 How can I customize the look of a QPushButton or QToolButton to look something like elementaryos's webpage "buttons"? All I really want is the characteristic image position and the text on it's side, maybe if i'm lucky i can also get a border like that, but i don't really need the little description below the title :) Can i do it only with StyleSheets, or do i have to subclass QPushButton/QAbstractButton/Something like that? I already searched everywhere but didn't found that level of

How to set a different background-color to a disabled button with QSS?

你。 提交于 2019-12-07 15:29:06
问题 I have already tried to use disabled and !enabled but it doesn't work. Here is my QSS code : QPushButton { background-color:#44c767; border-radius:5px; border:1px solid #18ab29; color:#ffffff; font-family:arial; font-size:15px; font-weight:bold; text-decoration:none; padding-right:10px; outline: 0; } QPushButton:hover:!pressed { background-color:#54d777; } QPushButton: pressed { background-color:#30b252; } QPushButton: disabled { background-color:#ff0000; } QPushButton: !enabled { background

Specific QPushButton style

Deadly 提交于 2019-12-06 14:25:39
How can I customize the look of a QPushButton or QToolButton to look something like elementaryos's webpage "buttons"? All I really want is the characteristic image position and the text on it's side, maybe if i'm lucky i can also get a border like that, but i don't really need the little description below the title :) Can i do it only with StyleSheets, or do i have to subclass QPushButton/QAbstractButton/Something like that? I already searched everywhere but didn't found that level of customization without things like painting something in a fixed place, which is exactly what i don't want.

Qt QCalendarWidget QSS Styling

霸气de小男生 提交于 2019-12-06 12:49:31
问题 I know there's no support for QCalendarWidget QSS styling but does anyone know some workarounds for changing the color of sections 1 and 2 of the QCalendarWidget ? (the light blue for section 1 and white for section 2 ) Thanks! 回答1: I've examined QCalendarWidget source code and found the solution. QCalendarWidget internally has a model and a view to display days. QCalendarModel has a formatForCell(int, int) function that returns QTextCharFormat for a given cell. Returning format is the result

QTreeView Item Hover/Selected background color based on current color

瘦欲@ 提交于 2019-12-06 11:10:59
问题 In my project I have several QTreeView widgets displaying data. The background color of the items in the QTreeView changes depending on the data's type and association with other items. Here is how those background colors are set: QColor warning; warning.setRgb(255, 86, 86); model->itemFromIndex(index)->setData(warning, Qt::BackgroundRole); This works, but I also want to have different background colors when an item is selected/hovered. I opted to use a stylesheet. QTreeView::item:selected

Error while changing QObject stylesheet in a Thread

岁酱吖の 提交于 2019-12-06 09:18:43
Context I want to build QObject animations in python. For example, I tried animating the background of a QLineEdit object in order to make a "red flash" when a something wrong is entered. The function is working, the thread starts and I see the animation, but when the thread ends, the app collapses without error trace-back. I only get exit code -1073740940 Which I didn't find on the internet. Minimal Working Example Here's a mwe that I made in order for you to reproduce this error with only one file. You will notice that the important part of the code is inside LoginDialog class. from PyQt5

[Qt]How to support :pressed state of style sheet for custom widget?

蓝咒 提交于 2019-12-06 04:22:10
What i have :- I have a custom widget which extends QFrame (instead of QWidget as QFrame already has a working paintEvent implementation). I have overridden the mousePressed() and mouseReleased() to emit the pressed() released() and clicked() Signals. Everything upto this point is woring fine as expected. What i need :- This custom widget is having basic style sheet support and it supports the :hover state just fine. But the :pressed state is not working. I have already figured out that this is bcoz its not supported by QFrame/QLabel etc. I wish to know what do i need to do in order to support

How to set a different background-color to a disabled button with QSS?

南笙酒味 提交于 2019-12-06 02:31:47
I have already tried to use disabled and !enabled but it doesn't work. Here is my QSS code : QPushButton { background-color:#44c767; border-radius:5px; border:1px solid #18ab29; color:#ffffff; font-family:arial; font-size:15px; font-weight:bold; text-decoration:none; padding-right:10px; outline: 0; } QPushButton:hover:!pressed { background-color:#54d777; } QPushButton: pressed { background-color:#30b252; } QPushButton: disabled { background-color:#ff0000; } QPushButton: !enabled { background-color:#ff0000; } The documentation refers to a disabled pseudo state but without providing more

Qt QCalendarWidget QSS Styling

让人想犯罪 __ 提交于 2019-12-04 16:09:39
I know there's no support for QCalendarWidget QSS styling but does anyone know some workarounds for changing the color of sections 1 and 2 of the QCalendarWidget ? (the light blue for section 1 and white for section 2 ) Thanks! I've examined QCalendarWidget source code and found the solution. QCalendarWidget internally has a model and a view to display days. QCalendarModel has a formatForCell(int, int) function that returns QTextCharFormat for a given cell. Returning format is the result of merging QCalendarView palette data, a format for current day (saturday and sunday are shown in red) and

Stylesheets, widgets hidden and sizes in Qt

为君一笑 提交于 2019-12-04 14:47:45
问题 There is a big problem with stylesheets. If you set the sizes through the style sheet by setting max and min values the same (fixed size) or whatever, and then you try to fetch them using size() on the widget, if the widget has never been shown the sizes you get are weird. But you can't fetch them from the stylesheet neither, so you have to show all widgets before resizing or fetching the positions. In my case, i start with a window. But the widgets under this window will appear later, and