Commit 8c00371a authored by Ingo Klöcker's avatar Ingo Klöcker Committed by Ingo Klöcker
Browse files

kstyle: Draw explicitly added focus frames

By default, a focus frame should only be drawn for a selected list of
widgets. But if an application developer explicitly adds a QFocusFrame
for some other widget that Breeze doesn't handle by default, then the
frame should also be drawn.
parent bb4024d0
Pipeline #194133 passed with stage
in 5 minutes and 47 seconds
......@@ -1347,9 +1347,16 @@ bool Style::event(QEvent *e)
focusWidget = focusProxy;
focusProxy = focusWidget->focusProxy();
}
target = focusWidget;
// by default we want to draw a focus frame only for the following widgets
if (focusWidget->inherits("QLineEdit") || focusWidget->inherits("QTextEdit") || focusWidget->inherits("QAbstractSpinBox")
|| focusWidget->inherits("QComboBox") || focusWidget->inherits("QPushButton") || focusWidget->inherits("QToolButton")
|| focusWidget->inherits("QCheckBox") || focusWidget->inherits("QRadioButton") || focusWidget->inherits("QSlider")
|| focusWidget->inherits("QDial") || focusWidget->inherits("QGroupBox")) {
target = focusWidget;
}
}
}
if (_focusFrame) {
// sets to nullptr or a widget
_focusFrame->setWidget(target);
......@@ -5741,7 +5748,8 @@ bool Style::drawFocusFrame(const QStyleOption *option, QPainter *painter, const
outerRect = innerRect.adjusted(-hmargin, -vmargin, hmargin, vmargin);
focusFramePath.addRoundedRect(outerRect, outerRadius, outerRadius);
} else {
return true;
focusFramePath.addRoundedRect(innerRect, innerRadius, innerRadius);
focusFramePath.addRoundedRect(outerRect, outerRadius, outerRadius);
}
auto outerColor = _helper->alphaColor(option->palette.highlight().color(), 0.33);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment