MCPcopy Create free account
hub / github.com/chris2511/xca / eventFilter

Method eventFilter

widgets/XcaApplication.cpp:144–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144bool XcaApplication::eventFilter(QObject *watched, QEvent *ev)
145{
146 static int mctr;
147 QMouseEvent *me;
148 QStringList l;
149 XcaTreeView *treeview;
150 int key;
151
152 switch (ev->type()) {
153 case QEvent::FileOpen:
154 l << static_cast<QFileOpenEvent *>(ev)->file();
155 mainw->openURLs(l);
156 return true;
157 case QEvent::MouseMove:
158 case QEvent::NonClientAreaMouseMove:
159 if (mctr++ > 8) {
160 me = static_cast<QMouseEvent *>(ev);
161#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
162 QPoint p = me->globalPosition().toPoint();
163#else
164 QPoint p = me->globalPos();
165#endif
166 Entropy::add(p.x());
167 Entropy::add(p.y());
168 mctr = 0;
169 }
170 break;
171 case QEvent::KeyPress:
172 key = static_cast<QKeyEvent *>(ev)->key();
173 if (key < 0x100) {
174 Entropy::add(key);
175 }
176 break;
177 case QEvent::MouseButtonPress:
178 me = static_cast<QMouseEvent *>(ev);
179 treeview = watched ?
180 dynamic_cast<XcaTreeView*>(watched->parent()) : NULL;
181
182 if ((watched == mainw || treeview) &&
183 me->button() == Qt::MiddleButton &&
184 QApplication::clipboard()->supportsSelection())
185 {
186 mainw->pastePem();
187 return true;
188 }
189 break;
190 default:
191 break;
192 }
193 return false;
194}
195
196bool XcaApplication::notify(QObject* receiver, QEvent* event)
197{

Callers

nothing calls this directly

Calls 4

openURLsMethod · 0.80
parentMethod · 0.80
pastePemMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected