X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fwizard.h;h=134e4e0be63771f2c73670ffd99aee748d78d3ec;hb=b8684fb22577d9e5b19944d814840187690b51c2;hp=ec430ec47f6f942fce1ec98b9d368eb95dfdb9f5;hpb=3b400d92b6d7ecb9fbe51a94367816ef71e1512b;p=kdenlive diff --git a/src/wizard.h b/src/wizard.h index ec430ec4..134e4e0b 100644 --- a/src/wizard.h +++ b/src/wizard.h @@ -42,18 +42,17 @@ public: } void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { if (index.column() == 1) { - const bool hover = option.state & (QStyle::State_Selected); - QRect r1 = option.rect; painter->save(); - if (hover) { - painter->setPen(option.palette.color(QPalette::HighlightedText)); - QColor backgroundColor = option.palette.color(QPalette::Highlight); - painter->setBrush(QBrush(backgroundColor)); - painter->fillRect(r1, backgroundColor); - } + QStyleOptionViewItemV4 opt(option); + QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); + const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1; + style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget); + QFont font = painter->font(); font.setBold(true); painter->setFont(font); + QRect r1 = option.rect; + r1.adjust(0, textMargin, 0, - textMargin); int mid = (int)((r1.height() / 2)); r1.setBottom(r1.y() + mid); QRect r2 = option.rect; @@ -62,7 +61,6 @@ public: font.setBold(false); painter->setFont(font); QString subText = index.data(Qt::UserRole).toString(); - painter->setPen(option.palette.color(QPalette::Mid)); painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText); painter->restore(); } else { @@ -76,7 +74,7 @@ class Wizard : public QWizard { Q_OBJECT public: - Wizard(bool upgrade, QWidget * parent = 0); + explicit Wizard(bool upgrade, QWidget * parent = 0); void installExtraMimes(QString baseName, QStringList globs); void runUpdateMimeDatabase(); void adjustSettings();