feat(ui): move editing context breadcrumb to viewport overlay (#232)
Some checks failed
Build and Test / build (pull_request) Has been cancelled
Some checks failed
Build and Test / build (pull_request) Has been cancelled
Convert BreadcrumbToolBar from a QToolBar in the MainWindow toolbar area to a QFrame overlay at the top-left of each 3D viewport. Changes: - BreadcrumbToolBar: change base class from QToolBar to QFrame, use QHBoxLayout instead of toolbar actions, semi-transparent overlay background with rounded corners - MainWindow: remove breadcrumb toolbar creation, toolbar break, and signal connection - View3DInventor: create per-view BreadcrumbToolBar as a child of the GL viewer widget, positioned at (8,8) with event filter to keep it raised on viewport resize Each 3D view now has its own breadcrumb instance connected to the EditingContextResolver singleton. This reclaims the full-width toolbar row and keeps the editing context visually tied to the viewport.
This commit is contained in:
@@ -60,7 +60,9 @@
|
||||
#include "View3DInventor.h"
|
||||
#include "View3DSettings.h"
|
||||
#include "Application.h"
|
||||
#include "BreadcrumbToolBar.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "EditingContext.h"
|
||||
#include "Camera.h"
|
||||
#include "Document.h"
|
||||
#include "FileDialog.h"
|
||||
@@ -145,6 +147,19 @@ View3DInventor::View3DInventor(
|
||||
// apply the user settings
|
||||
applySettings();
|
||||
|
||||
// Breadcrumb overlay at top-left of viewport
|
||||
_breadcrumb = new BreadcrumbToolBar(_viewer->getWidget());
|
||||
_breadcrumb->move(8, 8);
|
||||
_breadcrumb->raise();
|
||||
_breadcrumb->show();
|
||||
_viewer->getWidget()->installEventFilter(this);
|
||||
|
||||
auto* ctxResolver = EditingContextResolver::instance();
|
||||
connect(ctxResolver, &EditingContextResolver::contextChanged,
|
||||
_breadcrumb, &BreadcrumbToolBar::updateContext);
|
||||
// Apply the current context immediately
|
||||
_breadcrumb->updateContext(ctxResolver->currentContext());
|
||||
|
||||
stopSpinTimer = new QTimer(this);
|
||||
connect(stopSpinTimer, &QTimer::timeout, this, &View3DInventor::stopAnimating);
|
||||
|
||||
@@ -935,6 +950,17 @@ void View3DInventor::contextMenuEvent(QContextMenuEvent* e)
|
||||
MDIView::contextMenuEvent(e);
|
||||
}
|
||||
|
||||
bool View3DInventor::eventFilter(QObject* obj, QEvent* ev)
|
||||
{
|
||||
if (obj == _viewer->getWidget() && ev->type() == QEvent::Resize) {
|
||||
// Keep breadcrumb at top-left after viewport resize
|
||||
if (_breadcrumb) {
|
||||
_breadcrumb->raise();
|
||||
}
|
||||
}
|
||||
return MDIView::eventFilter(obj, ev);
|
||||
}
|
||||
|
||||
void View3DInventor::customEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::User) {
|
||||
|
||||
Reference in New Issue
Block a user