Start: make compound widget in FileCardDelegate::paint() more flexible for Qt style sheets
This commit is contained in:
@@ -110,27 +110,34 @@ void FileCardDelegate::paint(QPainter* painter,
|
||||
thumbnail->setFixedSize(thumbnailSize, thumbnailSize);
|
||||
thumbnail->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
|
||||
|
||||
widget->setProperty("state", QStringLiteral(""));
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
QColor color = getSelectionColor();
|
||||
widget->setStyleSheet(QString::fromLatin1("QWidget#thumbnailWidget {"
|
||||
" border: 2px solid rgb(%1, %2, %3);"
|
||||
" border-radius: 4px;"
|
||||
" padding: 2px;"
|
||||
"}")
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue()));
|
||||
widget->setProperty("state", QStringLiteral("pressed"));
|
||||
if (qApp->styleSheet().isEmpty()) {
|
||||
QColor color = getSelectionColor();
|
||||
widget->setStyleSheet(QString::fromLatin1("QWidget#thumbnailWidget {"
|
||||
" border: 2px solid rgb(%1, %2, %3);"
|
||||
" border-radius: 4px;"
|
||||
" padding: 2px;"
|
||||
"}")
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue()));
|
||||
}
|
||||
}
|
||||
else if (option.state & QStyle::State_MouseOver) {
|
||||
QColor color = getBorderColor();
|
||||
widget->setStyleSheet(QString::fromLatin1("QWidget#thumbnailWidget {"
|
||||
" border: 2px solid rgb(%1, %2, %3);"
|
||||
" border-radius: 4px;"
|
||||
" padding: 2px;"
|
||||
"}")
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue()));
|
||||
widget->setProperty("state", QStringLiteral("hovered"));
|
||||
if (qApp->styleSheet().isEmpty()) {
|
||||
QColor color = getBorderColor();
|
||||
widget->setStyleSheet(QString::fromLatin1("QWidget#thumbnailWidget {"
|
||||
" border: 2px solid rgb(%1, %2, %3);"
|
||||
" border-radius: 4px;"
|
||||
" padding: 2px;"
|
||||
"}")
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue()));
|
||||
}
|
||||
}
|
||||
else if (qApp->styleSheet().isEmpty()) {
|
||||
QColor color = getBackgroundColor();
|
||||
|
||||
Reference in New Issue
Block a user