Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Remove dedicated "show editing toolbar" action from 3d windows" #60414

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 2 additions & 42 deletions src/app/3d/qgs3dmapcanvaswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
{
const QgsSettings setting;

mToolbarMenu = new QMenu( tr( "Toolbars" ), this );
mToolbarMenu->setObjectName( QStringLiteral( "mToolbarMenu" ) );

QToolBar *toolBar = new QToolBar( this );
toolBar->setIconSize( QgisApp::instance()->iconSize( isDocked ) );

Expand All @@ -82,7 +79,6 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )

// Editing toolbar
mEditingToolBar = new QToolBar( this );
mEditingToolBar->setWindowTitle( tr( "Editing Toolbar" ) );
mEditingToolBar->setVisible( false );

QAction *actionPointCloudChangeAttributeTool = mEditingToolBar->addAction( QIcon( QgsApplication::iconPath( "mActionSelectPolygon.svg" ) ), tr( "Change Point Cloud Attribute" ), this, &Qgs3DMapCanvasWidget::changePointCloudAttribute );
Expand All @@ -94,6 +90,8 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
mSpinChangeAttributeValue = new QgsDoubleSpinBox();
mEditingToolBar->addWidget( new QLabel( tr( "Value" ) ) );
mEditingToolBar->addWidget( mSpinChangeAttributeValue );
QAction *actionEditingToolbar = toolBar->addAction( QIcon( QgsApplication::iconPath( "mIconPointCloudLayer.svg" ) ), tr( "Show Editing Toolbar" ), this, [this] { mEditingToolBar->setVisible( !mEditingToolBar->isVisible() ); } );
actionEditingToolbar->setCheckable( true );
connect( mCboChangeAttribute, qOverload<int>( &QComboBox::currentIndexChanged ), this, [this]( int ) { onPointCloudChangeAttributeSettingsChanged(); } );
connect( mSpinChangeAttributeValue, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), this, [this]( double ) { onPointCloudChangeAttributeSettingsChanged(); } );

Expand Down Expand Up @@ -344,24 +342,6 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
} );

updateLayerRelatedActions( QgisApp::instance()->activeLayer() );

QList<QAction *> toolbarMenuActions;
// Set action names so that they can be used in customization
for ( QToolBar *toolBar : { mEditingToolBar } )
{
toolBar->toggleViewAction()->setObjectName( "mActionToggle" + toolBar->objectName().mid( 1 ) );
toolbarMenuActions << toolBar->toggleViewAction();
}

// sort actions in toolbar menu
std::sort( toolbarMenuActions.begin(), toolbarMenuActions.end(), []( QAction *a, QAction *b ) {
return QString::localeAwareCompare( a->text(), b->text() ) < 0;
} );

mToolbarMenu->addActions( toolbarMenuActions );

toolBar->installEventFilter( this );
mEditingToolBar->installEventFilter( this );
}

Qgs3DMapCanvasWidget::~Qgs3DMapCanvasWidget()
Expand Down Expand Up @@ -474,26 +454,6 @@ void Qgs3DMapCanvasWidget::updateLayerRelatedActions( QgsMapLayer *layer )
enableEditingTools( pcLayer->isEditable() );
}

bool Qgs3DMapCanvasWidget::eventFilter( QObject *watched, QEvent *event )
{
if ( qobject_cast< QToolBar * >( watched ) )
{
if ( event->type() != QEvent::MouseButtonPress )
return QObject::eventFilter( watched, event );

QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>( event );
if ( !mouseEvent )
return QObject::eventFilter( watched, event );

if ( mouseEvent->button() != Qt::RightButton )
return QObject::eventFilter( watched, event );

mToolbarMenu->exec( mouseEvent->globalPos() );
return false;
}
return QObject::eventFilter( watched, event );
}

void Qgs3DMapCanvasWidget::toggleNavigationWidget( bool visibility )
{
mNavigationWidget->setVisible( visibility );
Expand Down
5 changes: 0 additions & 5 deletions src/app/3d/qgs3dmapcanvaswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget

void updateLayerRelatedActions( QgsMapLayer *layer );

bool eventFilter( QObject *watched, QEvent *event ) override;


private slots:
void resetView();
void configure();
Expand Down Expand Up @@ -164,8 +161,6 @@ class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget
QToolBar *mEditingToolBar = nullptr;
QComboBox *mCboChangeAttribute = nullptr;
QgsDoubleSpinBox *mSpinChangeAttributeValue = nullptr;

QMenu *mToolbarMenu = nullptr;
};

#endif // QGS3DMAPCANVASWIDGET_H
Loading