PDA

View Full Version : Selector for a tab with unread data



fedon
15th March 2017, 12:02
I use css style to distinguish tabs in Konsole application:


QTabBar::tab:selected {
background: #4286f4
}
QTabBar::tab:hover {
background: #dff442
}
QTabBar::tab:selected:hover {
background: #fd4442
}
QTabBar::tab {
background: #449449
}

Everything works fine. The only problem I can not solve is foreground for a tab which has unread data. Does anyone know which selector to use? Default style conflicts with my color.

anda_skoa
16th March 2017, 11:11
The application code might need to support that by having a property on the tab for "has unread data" which you can then use in the selector.

Cheers,
_

fedon
18th March 2017, 10:35
Can you please point me to some example of a widget custom state implementation? And how it is connected to setStyleSheet if at all.

Thanks in advance

anda_skoa
22nd March 2017, 08:53
See http://doc.qt.io/qt-5/qobject.html#Q_PROPERTY for declaring properties, see "property selector" here (http://doc.qt.io/qt-5/stylesheet-syntax.html#selector-types) on how to use them in the style sheet

Cheers,
_