MCPcopy Create free account
hub / github.com/KDE/kdevelop / cleanContextMenu

Method cleanContextMenu

kdevplatform/shell/textdocument.cpp:211–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209 }
210
211 void cleanContextMenu()
212 {
213 if (!addedContextMenu) {
214 return;
215 }
216
217 if (currentContextMenu) {
218 const auto actions = addedContextMenu->actions();
219 for (QAction* action : actions) {
220 currentContextMenu->removeAction(action);
221 }
222 currentContextMenu.clear();
223 }
224
225 // The addedContextMenu owns those actions created on-the-fly for the context menu
226 // (other than those actions only shared for the context menu, but also used elsewhere)
227 // and thuse deletes then on its own destruction.
228 // Some actions potentially could be connected to triggered-signal handlers
229 // using Qt::QueuedConnection (at least SwitchToBuddyPlugin does so currently).
230 // Deleting them here also would also delete the connection before the handler is triggered.
231 // So we delay the menu's and thus their destruction to the next eventloop by default.
232 addedContextMenu->deleteLater();
233 addedContextMenu = nullptr;
234 }
235
236 TextDocument * const q;
237

Callers 2

unpopulateContextMenuMethod · 0.80
populateContextMenuMethod · 0.80

Calls 3

removeActionMethod · 0.80
actionsMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected