Commit 14ecec53 authored by Kevin Ottens's avatar Kevin Ottens

Fix the exclusive group box case for default indicators

Summary:
Turns out there was an oversight here, in case of an exclusive group
box, the emitter widget is a button inside the group box which can have
any name (this was thus caught by the assert).

So now we also check if the sender is a button and if that's the case we
verify if its in one of the known exclusive group boxes. If yes we use
the group box as reference for the indicator work.

Reviewers: ngraham, davidedmundson, bport, crossi

Reviewed By: ngraham

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29014
parent 11186c05
......@@ -592,7 +592,27 @@ KConfigDialogManagerPrivate::KConfigDialogManagerPrivate(KConfigDialogManager *q
void KConfigDialogManagerPrivate::onWidgetModified()
{
const auto widget = qobject_cast<QWidget*>(q->sender());
const auto senderWidget = qobject_cast<QWidget *>(q->sender());
Q_ASSERT(senderWidget);
const auto widget = [=]() -> QWidget * {
const auto senderButton = qobject_cast<QAbstractButton *>(senderWidget);
if (!senderButton) {
return senderWidget;
}
if (senderButton->objectName().startsWith("kcfg_")) {
return senderButton;
}
for (auto groupBox : qAsConst(allExclusiveGroupBoxes)) {
const auto buttons = groupBox->findChildren<QAbstractButton *>();
if (buttons.contains(senderButton)) {
return groupBox;
}
}
return senderButton;
}();
Q_ASSERT(widget && widget->objectName().startsWith("kcfg_"));
const auto configId = widget->objectName().mid(5);
updateWidgetIndicator(configId, widget);
......
Markdown is supported
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