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

Method eventFilter

plugins/externalscript/externalscriptview.cpp:105–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105bool ExternalScriptView::eventFilter(QObject* obj, QEvent* e)
106{
107 // no, listening to activated() is not enough since that would also trigger the edit mode which we do _not_ want here
108 // users may still rename stuff via select + F2 though
109 if (obj == scriptTree->viewport()) {
110// const bool singleClick = KGlobalSettings::singleClick();
111 const bool singleClick = true; //FIXME: enable singleClick for the sake of porting, should find a proper way
112 if ((!singleClick && e->type() == QEvent::MouseButtonDblClick) ||
113 (singleClick && e->type() == QEvent::MouseButtonRelease)) {
114 auto* mouseEvent = dynamic_cast<QMouseEvent*>(e);
115 Q_ASSERT(mouseEvent);
116 ExternalScriptItem* item = itemForIndex(scriptTree->indexAt(mouseEvent->pos()));
117 if (item) {
118 m_plugin->execute(item);
119 e->accept();
120 return true;
121 }
122 }
123 }
124 return QObject::eventFilter(obj, e);
125}
126
127void ExternalScriptView::addScript()
128{

Callers

nothing calls this directly

Calls 5

posMethod · 0.80
eventFilterFunction · 0.50
typeMethod · 0.45
executeMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected