diff --git a/CMakeLists.txt b/CMakeLists.txt index 58093ce..d0bd9ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default project(qad) set(qad_MAJOR 2) set(qad_MINOR 6) -set(qad_REVISION 0) +set(qad_REVISION 1) set(qad_SUFFIX ) set(qad_COMPANY SHS) set(qad_DOMAIN org.SHS) diff --git a/libs/graphic/graphic.cpp b/libs/graphic/graphic.cpp index a1c6103..65df99e 100644 --- a/libs/graphic/graphic.cpp +++ b/libs/graphic/graphic.cpp @@ -146,7 +146,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this), icon_pause_f = QImage(":/icons/pause-front.png"); aupdate = grid = isFit = navigation = true; aalias = bufferActive = isOGL = cancel = guides = hasLblX = hasLblY = isHover = false; - pause_ = only_expand_x = only_expand_y = m_LODOptimization = false; + pause_ = only_expand_x = only_expand_y = m_LODOptimization = was_trace = false; limit_.setCoords(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX); eminx = eminy = DBL_MAX; emaxx = emaxy = DBL_MIN; @@ -350,6 +350,8 @@ void Graphic::procZoom(QPointF view_center, double dzoom, Qt::KeyboardModifiers selrect.setRect(px - (px - selrect.x()) * scl, selrect.y(), selrect.width() * scl, selrect.height()); if (km == Qt::ShiftModifier) selrect.setRect(selrect.x(), py - (py - selrect.y()) * scl, selrect.width(), selrect.height() * scl); + if (km == Qt::AltModifier) + selrect.translate((dzoom > 0. ? 1. : -1.) * selrect.width() / 2., 0.); } } @@ -596,14 +598,14 @@ void Graphic::canvasMouseDoubleClickEvent(QMouseEvent * ) { void Graphic::canvasWheelEvent(QWheelEvent * e) { #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - emit graphicWheelEvent(canvas2real(e->position()), e->angleDelta().y()/* TODO: test use angleDelta()*/); + emit graphicWheelEvent(canvas2real(e->position()), e->angleDelta().y()); #else emit graphicWheelEvent(canvas2real(QPointF(e->pos())), e->delta()); #endif if (gestures) return; if (!navigation) return; #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - procZoom(e->position(), e->angleDelta().y(), e->modifiers()); + procZoom(e->position(), e->modifiers() == Qt::AltModifier ? e->angleDelta().x() : e->angleDelta().y(), e->modifiers()); #else procZoom(e->pos(), e->delta(), e->modifiers()); #endif @@ -1426,6 +1428,7 @@ void Graphic::drawGuides() { QPointF rpos = canvas2real(apos); QString str; str = pointCoords(rpos) + fp_size; + bool trace_found = false; auto trace_axis_func = [&](bool on_x, double cursor) { if (curTrace >= 0 && curTrace < graphics.size()) { auto & t(graphics[curTrace]); @@ -1447,6 +1450,7 @@ void Graphic::drawGuides() { rpos = pol[index]; apos = real2canvas(rpos).toPoint(); str = pointCoords(pol[index]) + fp_size; + trace_found = true; emit graphicTraceEvent(curTrace, rpos); } } @@ -1478,11 +1482,12 @@ void Graphic::drawGuides() { } } } - if (gr >= 0) { - apos = real2canvas(rpos).toPoint(); - str = " " + graphics[gr].name + ": " + pointCoords(rpos) + fp_size; - emit graphicTraceEvent(curTrace, point); - } + } + if (gr >= 0) { + apos = real2canvas(rpos).toPoint(); + str = " " + graphics[gr].name + ": " + pointCoords(rpos) + fp_size; + trace_found = true; + emit graphicTraceEvent(gr, rpos); } }; switch (floating_axis_type) { @@ -1497,6 +1502,9 @@ void Graphic::drawGuides() { break; default: break; } + if (was_trace && !trace_found) + emit graphicTraceEvent(-1, QPointF()); + was_trace = trace_found; painter->drawLine(0, apos.y(), wid, apos.y()); painter->drawLine(apos.x(), 0, apos.x(), hei); QPoint p = apos + QPoint(font_sz.height() / 4., -font_sz.height() / 4.); diff --git a/libs/graphic/graphic.h b/libs/graphic/graphic.h index 8b44bcd..61d834c 100644 --- a/libs/graphic/graphic.h +++ b/libs/graphic/graphic.h @@ -429,7 +429,7 @@ protected: double eminx, eminy, emaxx, emaxy, pause_phase, gesture_angle; int lastw, lasth, min_repaint_int, timer_pause, thick; bool aalias, aupdate, grid, guides, isFit, isOGL, isHover, bufferActive, cancel, pause_, gestures, m_LODOptimization, m_fakeGL, need_createGL; - bool hasLblX, hasLblY, navigation, only_expand_y, only_expand_x, is_lines_update, leg_update, visible_update, fullscr, need_mouse_pan; + bool hasLblX, hasLblY, navigation, only_expand_y, only_expand_x, is_lines_update, leg_update, visible_update, fullscr, need_mouse_pan, was_trace; protected slots: void canvasPaintEvent();