Skip to content

Commit

Permalink
Merge pull request #111 from mikelsv/StatusBar-Zero-Coordinates
Browse files Browse the repository at this point in the history
Add Zero coordinate to StatusBar
  • Loading branch information
XRay3D authored Mar 7, 2024
2 parents 2a17bdb + 26a1890 commit a65c200
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions GGEasy/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ MainWindow::MainWindow(QWidget* parent)
ui.statusbar->showMessage(QString("X = %1, Y = %2").arg(point.x()).arg(point.y()));
});

connect(ui.graphicsView, &GraphicsView::mouseMove2, [this](const QPointF& point, const QPointF& gpoint) {
ui.statusbar->showMessage(QString("Home: X = %1, Y = %2\t\t\t\tZero: X = %3, Y = %4").arg(point.x()).arg(point.y()).arg(gpoint.x()).arg(gpoint.y()));
});

ui.treeView->setModel(new FileTree::Model(ui.treeView));

connect(ui.treeView, &FileTree::View::saveGCodeFile, this, &MainWindow::saveGCodeFile);
Expand Down
7 changes: 6 additions & 1 deletion static_libs/graphicsview/graphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,12 @@ void GraphicsView::mouseMoveEvent(QMouseEvent* event) {
if (ruler_ && rulerCtr & 0x1)
rulPt2 = point;

emit mouseMove(point);
// расчёт смещения для нулевых координат
QPointF hpoint = App::project()->homePos();
QPointF zpoint = App::project()->zeroPos();
QPointF gpoint = hpoint - zpoint + point;

emit mouseMove2(point, gpoint);
scene()->update();
}

Expand Down
1 change: 1 addition & 0 deletions static_libs/graphicsview/graphicsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class GraphicsView : public QGraphicsView {
signals:
void fileDroped(const QString&);
void mouseMove(const QPointF&);
void mouseMove2(const QPointF&, const QPointF&);
void mouseClickR(const QPointF&);
void mouseClickL(const QPointF&);

Expand Down

0 comments on commit a65c200

Please sign in to comment.