graphic trace fixes
This commit is contained in:
@@ -4,7 +4,7 @@ cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default
|
|||||||
project(qad)
|
project(qad)
|
||||||
set(qad_MAJOR 2)
|
set(qad_MAJOR 2)
|
||||||
set(qad_MINOR 6)
|
set(qad_MINOR 6)
|
||||||
set(qad_REVISION 0)
|
set(qad_REVISION 1)
|
||||||
set(qad_SUFFIX )
|
set(qad_SUFFIX )
|
||||||
set(qad_COMPANY SHS)
|
set(qad_COMPANY SHS)
|
||||||
set(qad_DOMAIN org.SHS)
|
set(qad_DOMAIN org.SHS)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
|
|||||||
icon_pause_f = QImage(":/icons/pause-front.png");
|
icon_pause_f = QImage(":/icons/pause-front.png");
|
||||||
aupdate = grid = isFit = navigation = true;
|
aupdate = grid = isFit = navigation = true;
|
||||||
aalias = bufferActive = isOGL = cancel = guides = hasLblX = hasLblY = isHover = false;
|
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);
|
limit_.setCoords(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
|
||||||
eminx = eminy = DBL_MAX;
|
eminx = eminy = DBL_MAX;
|
||||||
emaxx = emaxy = DBL_MIN;
|
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());
|
selrect.setRect(px - (px - selrect.x()) * scl, selrect.y(), selrect.width() * scl, selrect.height());
|
||||||
if (km == Qt::ShiftModifier)
|
if (km == Qt::ShiftModifier)
|
||||||
selrect.setRect(selrect.x(), py - (py - selrect.y()) * scl, selrect.width(), selrect.height() * scl);
|
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) {
|
void Graphic::canvasWheelEvent(QWheelEvent * e) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#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
|
#else
|
||||||
emit graphicWheelEvent(canvas2real(QPointF(e->pos())), e->delta());
|
emit graphicWheelEvent(canvas2real(QPointF(e->pos())), e->delta());
|
||||||
#endif
|
#endif
|
||||||
if (gestures) return;
|
if (gestures) return;
|
||||||
if (!navigation) return;
|
if (!navigation) return;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#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
|
#else
|
||||||
procZoom(e->pos(), e->delta(), e->modifiers());
|
procZoom(e->pos(), e->delta(), e->modifiers());
|
||||||
#endif
|
#endif
|
||||||
@@ -1426,6 +1428,7 @@ void Graphic::drawGuides() {
|
|||||||
QPointF rpos = canvas2real(apos);
|
QPointF rpos = canvas2real(apos);
|
||||||
QString str;
|
QString str;
|
||||||
str = pointCoords(rpos) + fp_size;
|
str = pointCoords(rpos) + fp_size;
|
||||||
|
bool trace_found = false;
|
||||||
auto trace_axis_func = [&](bool on_x, double cursor) {
|
auto trace_axis_func = [&](bool on_x, double cursor) {
|
||||||
if (curTrace >= 0 && curTrace < graphics.size()) {
|
if (curTrace >= 0 && curTrace < graphics.size()) {
|
||||||
auto & t(graphics[curTrace]);
|
auto & t(graphics[curTrace]);
|
||||||
@@ -1447,6 +1450,7 @@ void Graphic::drawGuides() {
|
|||||||
rpos = pol[index];
|
rpos = pol[index];
|
||||||
apos = real2canvas(rpos).toPoint();
|
apos = real2canvas(rpos).toPoint();
|
||||||
str = pointCoords(pol[index]) + fp_size;
|
str = pointCoords(pol[index]) + fp_size;
|
||||||
|
trace_found = true;
|
||||||
emit graphicTraceEvent(curTrace, rpos);
|
emit graphicTraceEvent(curTrace, rpos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1478,11 +1482,12 @@ void Graphic::drawGuides() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gr >= 0) {
|
}
|
||||||
apos = real2canvas(rpos).toPoint();
|
if (gr >= 0) {
|
||||||
str = " " + graphics[gr].name + ": " + pointCoords(rpos) + fp_size;
|
apos = real2canvas(rpos).toPoint();
|
||||||
emit graphicTraceEvent(curTrace, point);
|
str = " " + graphics[gr].name + ": " + pointCoords(rpos) + fp_size;
|
||||||
}
|
trace_found = true;
|
||||||
|
emit graphicTraceEvent(gr, rpos);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
switch (floating_axis_type) {
|
switch (floating_axis_type) {
|
||||||
@@ -1497,6 +1502,9 @@ void Graphic::drawGuides() {
|
|||||||
break;
|
break;
|
||||||
default: 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(0, apos.y(), wid, apos.y());
|
||||||
painter->drawLine(apos.x(), 0, apos.x(), hei);
|
painter->drawLine(apos.x(), 0, apos.x(), hei);
|
||||||
QPoint p = apos + QPoint(font_sz.height() / 4., -font_sz.height() / 4.);
|
QPoint p = apos + QPoint(font_sz.height() / 4., -font_sz.height() / 4.);
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ protected:
|
|||||||
double eminx, eminy, emaxx, emaxy, pause_phase, gesture_angle;
|
double eminx, eminy, emaxx, emaxy, pause_phase, gesture_angle;
|
||||||
int lastw, lasth, min_repaint_int, timer_pause, thick;
|
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 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:
|
protected slots:
|
||||||
void canvasPaintEvent();
|
void canvasPaintEvent();
|
||||||
|
|||||||
Reference in New Issue
Block a user