| 1243 | } |
| 1244 | |
| 1245 | void Viewport::mouseDoubleClickEvent(QMouseEvent *event) |
| 1246 | { |
| 1247 | assert (event); |
| 1248 | |
| 1249 | if (!_view.get_view_rect().contains(event->pos())) |
| 1250 | return; |
| 1251 | |
| 1252 | int mode = _view.session().get_device()->get_work_mode(); |
| 1253 | |
| 1254 | if (mode == LOGIC) |
| 1255 | { |
| 1256 | if (event->button() == Qt::RightButton) { |
| 1257 | if (_view.scale() == _view.get_maxscale()) |
| 1258 | _view.set_preScale_preOffset(); |
| 1259 | else |
| 1260 | _view.set_scale_offset(_view.get_maxscale(), _view.get_min_offset()); |
| 1261 | } |
| 1262 | else if (event->button() == Qt::LeftButton) { |
| 1263 | bool logic = false; |
| 1264 | uint64_t index; |
| 1265 | uint64_t index0 = 0, index1 = 0, index2 = 0; |
| 1266 | |
| 1267 | if (mode == LOGIC) { |
| 1268 | for(auto s : _view.session().get_signals()) { |
| 1269 | if (s->signal_type() == SR_CHANNEL_LOGIC) { |
| 1270 | view::LogicSignal *logicSig = (view::LogicSignal*)s; |
| 1271 | if (logicSig->measure(event->pos(), index0, index1, index2)) { |
| 1272 | logic = true; |
| 1273 | break; |
| 1274 | } |
| 1275 | } |
| 1276 | } |
| 1277 | } |
| 1278 | const double curX = event->pos().x(); |
| 1279 | const double curP = _view.index2pixel(index0); |
| 1280 | const double curN = _view.index2pixel(index1); |
| 1281 | |
| 1282 | if (logic && (curX - curP < SnapMinSpace || curN - curX < SnapMinSpace)) { |
| 1283 | if (curX - curP < curN - curX) |
| 1284 | index = index0; |
| 1285 | else |
| 1286 | index = index1; |
| 1287 | } |
| 1288 | else { |
| 1289 | index = _view.pixel2index(curX); |
| 1290 | } |
| 1291 | |
| 1292 | auto &cursor_list = _view.get_cursorList(); |
| 1293 | _view.add_cursor(index); |
| 1294 | _view.show_cursors(true); |
| 1295 | } |
| 1296 | |
| 1297 | update(UpdateEventType::UPDATE_EV_MS_CLICK); |
| 1298 | } |
| 1299 | else if (_view.session().get_device()->get_work_mode() == DSO |
| 1300 | && _view.session().is_init_status() == false |
| 1301 | && event->button() == Qt::LeftButton) { |
| 1302 | if (_dso_xm_valid) { |
nothing calls this directly
no test coverage detected