88{
89
92 }
96
97 if (conflictingShortcuts.isEmpty()) {
98 return;
99 }
100
101 struct ShortcutInfo {
104 };
105 QMap<QString, ShortcutInfo> conflictingShortcutsMap;
106
109 if (
m_d->actionInputConfigurationMap.contains(shortcut->
action())) {
110 ShortcutInfo &shortcutInfo = conflictingShortcutsMap[shortcut->
getInputText()];
111 shortcutInfo.shortcutObjects.append(shortcut);
113 shortcutInfo.actionTexts.append(shortcut->
action()->
name() +
" → " + subActionName);
114 } else {
115 qWarning() << "KisInputConfigurationPageItem does not exist for the specified action:"
117 }
118 } else {
119 qWarning() << "Action not set for the given shortcut.";
120 }
121 }
122
123 QMap<KisAbstractInputAction *, QSet<QString>> infoTexts;
124 Q_FOREACH (const ShortcutInfo &shortcutInfo, conflictingShortcutsMap) {
125 const QString text = "<b>" + shortcutInfo.shortcutObjects.first()->getInputText() + "</b>" + "<br> "
126 + shortcutInfo.actionTexts.join("<br> ");
128 infoTexts[shortcut->
action()] << text;
129 }
130 }
131
132 QMapIterator<KisAbstractInputAction *, QSet<QString>> it(infoTexts);
133 while (it.hasNext()) {
134 it.next();
135 QSetIterator<QString> it2(it.value());
136 if (!it2.hasNext()) {
137 continue;
138 }
139 QString text = "<ul> <li>" + it2.next() + "</li>";
140 while (it2.hasNext()) {
141 text += "<li>" + it2.next() + "</li>";
142 }
143 text += "</ul>";
144 m_d->actionInputConfigurationMap[it.key()]->setWarningEnabled(
true, text);
145 }
146}
void setWarningEnabled(bool enabled, QString additionalToolTipText=QString())
A class encapsulating all settings for a single shortcut.
KisAbstractInputAction * action() const
QString getInputText() const