summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles/modernwindows/qwindows11style.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/styles/modernwindows/qwindows11style.cpp')
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style.cpp368
1 files changed, 175 insertions, 193 deletions
diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp
index 7179109505b..7ae48a302f4 100644
--- a/src/plugins/styles/modernwindows/qwindows11style.cpp
+++ b/src/plugins/styles/modernwindows/qwindows11style.cpp
@@ -242,11 +242,11 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
QCachedPainter cp(painter, QLatin1StringView("win11_spinbox") % HexString<uint8_t>(colorSchemeIndex),
sb, sb->rect.size());
if (cp.needsPainting()) {
- const auto frameRect = option->rect.marginsRemoved(QMargins(1, 1, 1, 1));
+ const auto frameRect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5));
drawRoundedRect(cp.painter(), frameRect, Qt::NoPen, option->palette.brush(QPalette::Base));
if (sb->frame && (sub & SC_SpinBoxFrame))
- drawLineEditFrame(cp.painter(), option);
+ drawLineEditFrame(cp.painter(), frameRect, option);
const bool isMouseOver = state & State_MouseOver;
const bool hasFocus = state & State_HasFocus;
@@ -412,11 +412,11 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
#if QT_CONFIG(combobox)
case CC_ComboBox:
if (const QStyleOptionComboBox *combobox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- const auto frameRect = option->rect.marginsRemoved(QMargins(1, 1, 1, 1));
+ const auto frameRect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5));
drawRoundedRect(painter, frameRect, Qt::NoPen, option->palette.brush(QPalette::Base));
if (combobox->frame)
- drawLineEditFrame(painter, option);
+ drawLineEditFrame(painter, frameRect, option);
const bool isMouseOver = state & State_MouseOver;
const bool hasFocus = state & State_HasFocus;
@@ -668,7 +668,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
t->setStartValue(styleObject->property("_q_inner_radius").toFloat());
t->setEndValue(7.0f);
if (option->state & State_Sunken)
- t->setEndValue(2.0f);
+ t->setEndValue(4.0f);
else if (option->state & State_MouseOver && !(option->state & State_On))
t->setEndValue(7.0f);
else if (option->state & State_MouseOver && (option->state & State_On))
@@ -709,27 +709,19 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
switch (element) {
case PE_PanelTipLabel: {
- QRectF tipRect = option->rect.marginsRemoved(QMargins(1,1,1,1));
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.toolTipBase());
- painter->drawRoundedRect(tipRect, secondLevelRoundingRadius, secondLevelRoundingRadius);
-
- painter->setPen(highContrastTheme == true ? option->palette.buttonText().color() : WINUI3Colors[colorSchemeIndex][frameColorLight]);
- painter->setBrush(Qt::NoBrush);
- painter->drawRoundedRect(tipRect.marginsAdded(QMarginsF(0.5,0.5,0.5,0.5)), secondLevelRoundingRadius, secondLevelRoundingRadius);
+ const auto rect = QRectF(option->rect).marginsRemoved(QMarginsF(0.5, 0.5, 0.5, 0.5));
+ const auto pen = highContrastTheme ? option->palette.buttonText().color()
+ : winUI3Color(frameColorLight);
+ drawRoundedRect(painter, rect, pen, option->palette.toolTipBase());
break;
}
case PE_FrameTabWidget:
#if QT_CONFIG(tabwidget)
if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
- QRectF frameRect = frame->rect.marginsRemoved(QMargins(0,0,0,0));
- painter->setPen(Qt::NoPen);
- painter->setBrush(frame->palette.base());
- painter->drawRoundedRect(frameRect, secondLevelRoundingRadius, secondLevelRoundingRadius);
-
- painter->setPen(highContrastTheme == true ? frame->palette.buttonText().color() : WINUI3Colors[colorSchemeIndex][frameColorLight]);
- painter->setBrush(Qt::NoBrush);
- painter->drawRoundedRect(frameRect.marginsRemoved(QMarginsF(0.5,0.5,0.5,0.5)), secondLevelRoundingRadius, secondLevelRoundingRadius);
+ const auto rect = QRectF(option->rect).marginsRemoved(QMarginsF(0.5, 0.5, 0.5, 0.5));
+ const auto pen = highContrastTheme ? frame->palette.buttonText().color()
+ : winUI3Color(frameColorLight);
+ drawRoundedRect(painter, rect, pen, frame->palette.base());
}
#endif // QT_CONFIG(tabwidget)
break;
@@ -763,40 +755,41 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
}
}
break;
- case PE_IndicatorCheckBox:
- {
+ case PE_IndicatorCheckBox: {
const bool isRtl = option->direction == Qt::RightToLeft;
- QNumberStyleAnimation* animation = qobject_cast<QNumberStyleAnimation*>(d->animation(option->styleObject));
- QFontMetrics fm(d->assetFont);
+ const bool isOn = option->state & State_On;
+ const bool isPartial = option->state & State_NoChange;
QRectF rect = isRtl ? option->rect.adjusted(0, 0, -2, 0) : option->rect.adjusted(2, 0, 0, 0);
- QPointF center = QPointF(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
+ const QPointF center = rect.center();
rect.setWidth(15);
rect.setHeight(15);
rect.moveCenter(center);
- float clipWidth = animation != nullptr ? animation->currentValue() : 1.0f;
- QRectF clipRect = fm.boundingRect(QStringLiteral(u"\uE73E"));
- clipRect.moveCenter(center);
- clipRect.setLeft(rect.x() + (rect.width() - clipRect.width()) / 2.0);
- clipRect.setWidth(clipWidth * clipRect.width());
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(buttonFillBrush(option));
- painter->drawRoundedRect(rect, secondLevelRoundingRadius, secondLevelRoundingRadius, Qt::AbsoluteSize);
-
- painter->setPen(highContrastTheme == true ? option->palette.buttonText().color()
- : WINUI3Colors[colorSchemeIndex][frameColorStrong]);
- painter->setBrush(Qt::NoBrush);
- painter->drawRoundedRect(rect, secondLevelRoundingRadius + 0.5, secondLevelRoundingRadius + 0.5, Qt::AbsoluteSize);
+ QPen borderPen(Qt::NoPen);
+ if (!isOn && !isPartial) {
+ borderPen = highContrastTheme ? option->palette.buttonText().color()
+ : winUI3Color(frameColorStrong);
+ }
+ drawRoundedRect(painter, rect, borderPen, buttonFillBrush(option));
- painter->setFont(d->assetFont);
- painter->setPen(option->palette.highlightedText().color());
- painter->setBrush(option->palette.highlightedText());
- if (option->state & State_On)
+ if (isOn) {
+ painter->setFont(d->assetFont);
+ painter->setPen(option->palette.color(QPalette::Window));
+ QNumberStyleAnimation *animation = qobject_cast<QNumberStyleAnimation *>(
+ d->animation(option->styleObject));
+ QFontMetrics fm(d->assetFont);
+ float clipWidth = animation != nullptr ? animation->currentValue() : 1.0f;
+ QRectF clipRect = fm.boundingRect(QStringLiteral(u"\uE73E"));
+ clipRect.moveCenter(center);
+ clipRect.setLeft(rect.x() + (rect.width() - clipRect.width()) / 2.0);
+ clipRect.setWidth(clipWidth * clipRect.width());
painter->drawText(clipRect, Qt::AlignVCenter | Qt::AlignLeft, QStringLiteral(u"\uE73E"));
- else if (option->state & State_NoChange)
- painter->drawText(rect, Qt::AlignVCenter | Qt::AlignHCenter, QStringLiteral(u"\uE73C"));
+ } else if (isPartial) {
+ painter->setFont(d->assetFont);
+ painter->setPen(option->palette.color(QPalette::Window));
+ painter->drawText(rect, Qt::AlignCenter, QStringLiteral(u"\uE73C"));
+ }
}
break;
case PE_IndicatorBranch: {
@@ -814,9 +807,9 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
}
}
break;
- case PE_IndicatorRadioButton:
- {
+ case PE_IndicatorRadioButton: {
const bool isRtl = option->direction == Qt::RightToLeft;
+ const bool isOn = option->state & State_On;
qreal innerRadius = option->state & State_On ? 4.0f :7.0f;
if (option->styleObject) {
if (option->styleObject->property("_q_end_radius").isNull())
@@ -826,34 +819,26 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
option->styleObject->setProperty("_q_inner_radius", innerRadius);
}
- QPainterPath path;
QRectF rect = isRtl ? option->rect.adjusted(0, 0, -2, 0) : option->rect.adjusted(2, 0, 0, 0);
- QPointF center = QPoint(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
- rect.setWidth(15);
- rect.setHeight(15);
- rect.moveCenter(center);
- QRectF innerRect = rect;
- innerRect.setWidth(8);
- innerRect.setHeight(8);
- innerRect.moveCenter(center);
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.accent());
- path.addEllipse(center,7,7);
- path.addEllipse(center,innerRadius,innerRadius);
- painter->drawPath(path);
-
- painter->setPen(WINUI3Colors[colorSchemeIndex][frameColorStrong]);
- painter->setBrush(Qt::NoBrush);
- painter->drawEllipse(center, 7.5, 7.5);
- painter->drawEllipse(center,innerRadius + 0.5, innerRadius + 0.5);
+ const QPointF center = rect.center();
- painter->setPen(Qt::NoPen);
- if (option->state & State_MouseOver && option->state & State_Enabled)
- painter->setBrush(option->palette.window().color().darker(107));
- else
- painter->setBrush(option->palette.window());
- painter->drawEllipse(center,innerRadius, innerRadius);
+ if (isOn) {
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(buttonFillBrush(option));
+ QPainterPath path;
+ path.addEllipse(center, 7.5, 7.5);
+ path.addEllipse(center, innerRadius, innerRadius);
+ painter->drawPath(path);
+ QColor fillColor = option->palette.window().color();
+ if (option->state & State_MouseOver && option->state & State_Enabled)
+ fillColor = fillColor.darker(107);
+ painter->setBrush(fillColor);
+ painter->drawEllipse(center, innerRadius, innerRadius);
+ } else {
+ painter->setPen(winUI3Color(frameColorStrong));
+ painter->setBrush(buttonFillBrush(option));
+ painter->drawEllipse(center, 7.5, 7.5);
+ }
}
break;
case PE_PanelButtonTool:
@@ -910,7 +895,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
}
case PE_PanelLineEdit:
if (const auto *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- const auto frameRect = option->rect.marginsRemoved(QMargins(1, 1, 1, 1));
+ const auto frameRect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5));
drawRoundedRect(painter, frameRect, Qt::NoPen, option->palette.brush(QPalette::Base));
if (panel->lineWidth > 0)
@@ -922,12 +907,14 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
drawRoundedRect(painter, frameRect, Qt::NoPen, winUI3Color(subtleHighlightColor));
}
break;
- case PE_FrameLineEdit:
- drawLineEditFrame(painter, option);
+ case PE_FrameLineEdit: {
+ const auto frameRect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5));
+ drawLineEditFrame(painter, frameRect, option);
break;
+ }
case PE_Frame: {
if (const auto *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- const auto rect = option->rect.marginsRemoved(QMargins(1, 1, 1, 1));
+ const auto rect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5));
if (qobject_cast<const QComboBoxPrivateContainer *>(widget)) {
QPen pen;
if (highContrastTheme)
@@ -941,7 +928,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
if (frame->frameShape == QFrame::NoFrame)
break;
- drawLineEditFrame(painter, option, qobject_cast<const QTextEdit *>(widget) != nullptr);
+ drawLineEditFrame(painter, rect, option, qobject_cast<const QTextEdit *>(widget) != nullptr);
}
break;
}
@@ -1662,128 +1649,123 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
}
case CE_ItemViewItem: {
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
- if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget)) {
- QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
- QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget);
- QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget);
+ QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
+ QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget);
+ QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget);
- // draw the background
- proxy()->drawPrimitive(PE_PanelItemViewItem, option, painter, widget);
+ // draw the background
+ proxy()->drawPrimitive(PE_PanelItemViewItem, option, painter, widget);
- const QRect &rect = vopt->rect;
- const bool isRtl = option->direction == Qt::RightToLeft;
- bool onlyOne = vopt->viewItemPosition == QStyleOptionViewItem::OnlyOne ||
- vopt->viewItemPosition == QStyleOptionViewItem::Invalid;
- bool isFirst = vopt->viewItemPosition == QStyleOptionViewItem::Beginning;
- bool isLast = vopt->viewItemPosition == QStyleOptionViewItem::End;
+ const QRect &rect = vopt->rect;
+ const bool isRtl = option->direction == Qt::RightToLeft;
+ bool onlyOne = vopt->viewItemPosition == QStyleOptionViewItem::OnlyOne ||
+ vopt->viewItemPosition == QStyleOptionViewItem::Invalid;
+ bool isFirst = vopt->viewItemPosition == QStyleOptionViewItem::Beginning;
+ bool isLast = vopt->viewItemPosition == QStyleOptionViewItem::End;
- // the tree decoration already painted the left side of the rounded rect
- if (vopt->features.testFlag(QStyleOptionViewItem::IsDecoratedRootColumn) &&
- vopt->showDecorationSelected) {
- isFirst = false;
- if (onlyOne) {
- onlyOne = false;
- isLast = true;
- }
+ // the tree decoration already painted the left side of the rounded rect
+ if (vopt->features.testFlag(QStyleOptionViewItem::IsDecoratedRootColumn) &&
+ vopt->showDecorationSelected) {
+ isFirst = false;
+ if (onlyOne) {
+ onlyOne = false;
+ isLast = true;
}
+ }
- if (isRtl) {
- if (isFirst) {
- isFirst = false;
- isLast = true;
- } else if (isLast) {
- isFirst = true;
- isLast = false;
- }
+ if (isRtl) {
+ if (isFirst) {
+ isFirst = false;
+ isLast = true;
+ } else if (isLast) {
+ isFirst = true;
+ isLast = false;
}
- const bool highlightCurrent = vopt->state.testAnyFlags(State_Selected | State_MouseOver);
- if (highlightCurrent) {
- const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- if (highContrastTheme)
- painter->setBrush(vopt->palette.highlight());
- else
- painter->setBrush(view->alternatingRowColors() ? vopt->palette.highlight() : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]);
- QWidget *editorWidget = view ? view->indexWidget(view->currentIndex()) : nullptr;
- if (editorWidget) {
- QPalette pal = editorWidget->palette();
- QColor editorBgColor = vopt->backgroundBrush == Qt::NoBrush ? vopt->palette.color(widget->backgroundRole()) : vopt->backgroundBrush.color();
- editorBgColor.setAlpha(255);
- pal.setColor(editorWidget->backgroundRole(), editorBgColor);
- editorWidget->setPalette(pal);
- }
- } else {
- painter->setBrush(vopt->backgroundBrush);
+ }
+ const bool highlightCurrent = vopt->state.testAnyFlags(State_Selected | State_MouseOver);
+ if (highlightCurrent) {
+ const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
+ if (highContrastTheme)
+ painter->setBrush(vopt->palette.highlight());
+ else
+ painter->setBrush(view->alternatingRowColors() ? vopt->palette.highlight() : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]);
+ QWidget *editorWidget = view ? view->indexWidget(view->currentIndex()) : nullptr;
+ if (editorWidget) {
+ QPalette pal = editorWidget->palette();
+ QColor editorBgColor = vopt->backgroundBrush == Qt::NoBrush ? vopt->palette.color(widget->backgroundRole()) : vopt->backgroundBrush.color();
+ editorBgColor.setAlpha(255);
+ pal.setColor(editorWidget->backgroundRole(), editorBgColor);
+ editorWidget->setPalette(pal);
}
- painter->setPen(Qt::NoPen);
+ } else {
+ painter->setBrush(vopt->backgroundBrush);
+ }
+ painter->setPen(Qt::NoPen);
- if (onlyOne) {
- painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, 2, 2)),
- secondLevelRoundingRadius, secondLevelRoundingRadius);
- } else if (isFirst) {
- painter->save();
- painter->setClipRect(rect);
- painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, -secondLevelRoundingRadius, 2)),
- secondLevelRoundingRadius, secondLevelRoundingRadius);
- painter->restore();
- } else if (isLast) {
- painter->save();
- painter->setClipRect(rect);
- painter->drawRoundedRect(rect.marginsRemoved(QMargins(-secondLevelRoundingRadius, 2, 2, 2)),
- secondLevelRoundingRadius, secondLevelRoundingRadius);
- painter->restore();
- } else {
- painter->drawRect(rect.marginsRemoved(QMargins(0, 2, 0, 2)));
- }
+ if (onlyOne) {
+ painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, 2, 2)),
+ secondLevelRoundingRadius, secondLevelRoundingRadius);
+ } else if (isFirst) {
+ painter->save();
+ painter->setClipRect(rect);
+ painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, -secondLevelRoundingRadius, 2)),
+ secondLevelRoundingRadius, secondLevelRoundingRadius);
+ painter->restore();
+ } else if (isLast) {
+ painter->save();
+ painter->setClipRect(rect);
+ painter->drawRoundedRect(rect.marginsRemoved(QMargins(-secondLevelRoundingRadius, 2, 2, 2)),
+ secondLevelRoundingRadius, secondLevelRoundingRadius);
+ painter->restore();
+ } else {
+ painter->drawRect(rect.marginsRemoved(QMargins(0, 2, 0, 2)));
+ }
- // draw the check mark
- if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) {
- QStyleOptionViewItem option(*vopt);
- option.rect = checkRect;
- option.state = option.state & ~QStyle::State_HasFocus;
+ // draw the check mark
+ if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) {
+ QStyleOptionViewItem option(*vopt);
+ option.rect = checkRect;
+ option.state = option.state & ~QStyle::State_HasFocus;
- switch (vopt->checkState) {
- case Qt::Unchecked:
- option.state |= QStyle::State_Off;
- break;
- case Qt::PartiallyChecked:
- option.state |= QStyle::State_NoChange;
- break;
- case Qt::Checked:
- option.state |= QStyle::State_On;
- break;
- }
- proxy()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &option, painter, widget);
+ switch (vopt->checkState) {
+ case Qt::Unchecked:
+ option.state |= QStyle::State_Off;
+ break;
+ case Qt::PartiallyChecked:
+ option.state |= QStyle::State_NoChange;
+ break;
+ case Qt::Checked:
+ option.state |= QStyle::State_On;
+ break;
}
+ proxy()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &option, painter, widget);
+ }
- // draw the icon
- QIcon::Mode mode = QIcon::Normal;
- if (!(vopt->state & QStyle::State_Enabled))
- mode = QIcon::Disabled;
- else if (vopt->state & QStyle::State_Selected)
- mode = QIcon::Selected;
- QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
- vopt->icon.paint(painter, iconRect, vopt->decorationAlignment, mode, state);
-
- if (!view || !view->isPersistentEditorOpen(vopt->index)) {
- painter->setPen(highlightCurrent && highContrastTheme ? vopt->palette.base().color() : option->palette.text().color());
- d->viewItemDrawText(painter, vopt, textRect);
+ // draw the icon
+ QIcon::Mode mode = QIcon::Normal;
+ if (!(vopt->state & QStyle::State_Enabled))
+ mode = QIcon::Disabled;
+ else if (vopt->state & QStyle::State_Selected)
+ mode = QIcon::Selected;
+ QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
+ vopt->icon.paint(painter, iconRect, vopt->decorationAlignment, mode, state);
+
+ painter->setPen(highlightCurrent && highContrastTheme ? vopt->palette.base().color()
+ : vopt->palette.text().color());
+ d->viewItemDrawText(painter, vopt, textRect);
+
+ // paint a vertical marker for QListView
+ if (vopt->state & State_Selected) {
+ if (const QListView *lv = qobject_cast<const QListView *>(widget);
+ lv && lv->viewMode() != QListView::IconMode && !highContrastTheme) {
+ painter->setPen(vopt->palette.accent().color());
+ const auto xPos = isRtl ? rect.right() - 1 : rect.left();
+ const QLineF lines[2] = {
+ QLineF(xPos, rect.y() + 2, xPos, rect.y() + rect.height() - 2),
+ QLineF(xPos + 1, rect.y() + 2, xPos + 1, rect.y() + rect.height() - 2),
+ };
+ painter->drawLines(lines, 2);
}
- // paint a vertical marker for QListView
- if (vopt->state & State_Selected) {
- if (const QListView *lv = qobject_cast<const QListView *>(widget);
- lv && lv->viewMode() != QListView::IconMode && !highContrastTheme) {
- painter->setPen(vopt->palette.accent().color());
- const auto xPos = isRtl ? rect.right() - 1 : rect.left();
- const QLineF lines[2] = {
- QLineF(xPos, rect.y() + 2, xPos, rect.y() + rect.height() - 2),
- QLineF(xPos + 1, rect.y() + 2, xPos + 1, rect.y() + rect.height() - 2),
- };
- painter->drawLines(lines, 2);
- }
- }
- } else {
- QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget);
- d->viewItemDrawText(painter, vopt, textRect);
}
}
break;
@@ -2217,8 +2199,9 @@ void QWindows11Style::polish(QWidget* widget)
pal.setColor(scrollarea->viewport()->backgroundRole(), Qt::transparent);
scrollarea->viewport()->setPalette(pal);
scrollarea->viewport()->setProperty("_q_original_background_palette", originalPalette);
- if (qobject_cast<QTableView *>(widget))
- widget->setAttribute(Qt::WA_Hover, true);
+ // QTreeView & QListView are already set in the base windowsvista style
+ if (auto table = qobject_cast<QTableView *>(widget))
+ table->viewport()->setAttribute(Qt::WA_Hover, true);
}
}
@@ -2361,7 +2344,7 @@ QBrush QWindows11Style::buttonFillBrush(const QStyleOption *option)
if (!isOn && option->state & QStyle::State_AutoRaise)
return Qt::NoBrush;
if (option->state & QStyle::State_MouseOver)
- brush.setColor(isOn ? brush.color().lighter(107) : brush.color().darker(107));
+ brush.setColor(isOn ? brush.color().lighter(115) : brush.color().darker(107));
return brush;
}
@@ -2381,9 +2364,8 @@ QColor QWindows11Style::buttonLabelColor(const QStyleOption *option, int colorSc
: option->palette.buttonText().color();
}
-void QWindows11Style::drawLineEditFrame(QPainter *p, const QStyleOption *o, bool isEditable) const
+void QWindows11Style::drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable) const
{
- const auto rect = QRectF(o->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5));
const bool isHovered = o->state & State_MouseOver;
const auto frameCol = highContrastTheme
? o->palette.color(isHovered ? QPalette::Accent