mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
ifcviewer: F to frame selection from tree, debug coord dump
Tree -> viewport selection was already wired (onTreeSelectionChanged
calls setSelectedObjectId), but pressing F afterwards routed to the
focused tree widget rather than the viewport, so framing didn't fire.
Add a window-level View > Frame Selected QAction with Qt::Key_F that
delegates to ViewportWindow::focusOnSelectedObject — works regardless
of which child widget has focus. The viewport's own F handler stays
in place for when the viewport itself owns focus.
For debugging coordinate problems, add View > Print Selected Coords
(Ctrl+Shift+P) -> ViewportWindow::printSelectedObjectCoords, which
qInfo's:
- a sample vertex (first vertex of the selected mesh, decoded on
demand from the quantised VBO so no extra CPU storage is needed);
- placement_transformation (the per-instance matrix that maps the
sample vertex from mesh-local into the model's pre-georef frame);
- global = CoordinateOperation . placement_transformation (where
the IFC's own IfcCoordinateOperation has been folded in);
- the sample vertex transformed through both matrices.
The print is a no-op when nothing is selected or GL hasn't initialised.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -201,6 +201,17 @@ void MainWindow::setupMenus() {
|
||||
file_menu->addAction("&Quit", QKeySequence::Quit, qApp, &QApplication::quit);
|
||||
|
||||
auto* view_menu = menuBar()->addMenu("&View");
|
||||
// F frames the current selection. The viewport already binds F in its
|
||||
// own keyPressEvent for the case where it has focus; this duplicate at
|
||||
// window level is so the shortcut still fires when the tree, property
|
||||
// table, or any other child widget has keyboard focus.
|
||||
view_menu->addAction("&Frame Selected", this, [this]() {
|
||||
viewport_->focusOnSelectedObject();
|
||||
}, QKeySequence(Qt::Key_F));
|
||||
view_menu->addAction("Print Selected &Coords", this, [this]() {
|
||||
viewport_->printSelectedObjectCoords();
|
||||
}, QKeySequence("Ctrl+Shift+P"));
|
||||
view_menu->addSeparator();
|
||||
view_menu->addAction("Set &Home View", this, &MainWindow::onSetHomeView);
|
||||
view_menu->addAction("&Go to Home View", this, &MainWindow::onGoHomeView);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user