mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-03 18:44:13 +02:00
Add live cursor-coordinate readout to the element editor status bar (#580)
Displays the cursor's scene position (same grid units as the parts' X/Y property spinboxes) in a permanent status bar label, updated on every mouse move. Addresses the overlapping-node mis-click case from the originating forum report: with a live readout, precise pointing no longer requires guessing against nearby z-ordered points. ElementScene::mouseMoveEvent already computed the (optionally grid-snapped) scene position on every move; it now also emits it via a new mouseMoved(QPointF) signal, which QETElementEditor's status bar label subscribes to.
This commit is contained in:
@@ -1194,6 +1194,16 @@ void QETElementEditor::initGui()
|
||||
if (te) te->refreshMasterLabelVisibility();
|
||||
});
|
||||
|
||||
//Live cursor position readout, in the same scene coordinates as the parts' X/Y properties
|
||||
m_position_label = new QLabel(this);
|
||||
m_position_label->setMinimumWidth(120);
|
||||
statusBar()->addPermanentWidget(m_position_label);
|
||||
connect(m_elmt_scene, &ElementScene::mouseMoved, this, [this](const QPointF &pos) {
|
||||
m_position_label->setText(tr("X: %1 Y: %2")
|
||||
.arg(pos.x(), 0, 'f', 1)
|
||||
.arg(pos.y(), 0, 'f', 1));
|
||||
});
|
||||
|
||||
statusBar()->showMessage(tr("Éditeur d'éléments", "status bar message"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user