MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / eventFilter

Method eventFilter

DSView/pv/mainwindow.cpp:1220–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218 }
1219
1220 bool MainWindow::eventFilter(QObject *object, QEvent *event)
1221 {
1222 (void)object;
1223
1224 if (event->type() == QEvent::KeyPress)
1225 {
1226 const auto &sigs = _session->get_signals();
1227 QKeyEvent *ke = (QKeyEvent *)event;
1228
1229 int modifier = ke->modifiers();
1230
1231 if(modifier & Qt::ControlModifier ||
1232 modifier & Qt::ShiftModifier ||
1233 modifier & Qt::AltModifier)
1234 {
1235 return true;
1236 }
1237
1238 high_resolution_clock::time_point key_press_time = high_resolution_clock::now();
1239 milliseconds timeInterval = std::chrono::duration_cast<milliseconds>(key_press_time - _last_key_press_time);
1240 int64_t time_keep = timeInterval.count();
1241 if (time_keep < 200){
1242 return true;
1243 }
1244 _last_key_press_time = key_press_time;
1245
1246 switch (ke->key())
1247 {
1248 case Qt::Key_S:
1249 _sampling_bar->run_or_stop();
1250 break;
1251
1252 case Qt::Key_I:
1253 _sampling_bar->run_or_stop_instant();
1254 break;
1255
1256 case Qt::Key_T:
1257 _trig_bar->trigger_clicked();
1258 break;
1259
1260 case Qt::Key_D:
1261 _trig_bar->protocol_clicked();
1262 break;
1263
1264 case Qt::Key_M:
1265 _trig_bar->measure_clicked();
1266 break;
1267
1268 case Qt::Key_R:
1269 _trig_bar->search_clicked();
1270 break;
1271
1272 case Qt::Key_O:
1273 _sampling_bar->config_device();
1274 break;
1275
1276 case Qt::Key_PageUp:
1277 _view->set_scale_offset(_view->scale(),

Callers

nothing calls this directly

Calls 15

typeMethod · 0.80
run_or_stopMethod · 0.80
run_or_stop_instantMethod · 0.80
trigger_clickedMethod · 0.80
protocol_clickedMethod · 0.80
measure_clickedMethod · 0.80
search_clickedMethod · 0.80
config_deviceMethod · 0.80
set_scale_offsetMethod · 0.80
scaleMethod · 0.80
offsetMethod · 0.80
get_view_widthMethod · 0.80

Tested by

no test coverage detected