Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 28, 2023
1 parent 6f7f9c3 commit f5bfbf5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/app/3d/qgs3dmapcanvaswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,29 @@ void Qgs3DMapCanvasWidget::onExtentChanged()
mViewExtentHighlight->closePoints();
}
}

Qgs3dMapCanvasInputBridge::Qgs3dMapCanvasInputBridge( QObject *parent )
: QObject( parent )
{

}

bool Qgs3dMapCanvasInputBridge::eventFilter( QObject *watched, QEvent *event )
{
if ( Qgs3DMapCanvasWidget *widget = qobject_cast< Qgs3DMapCanvasWidget *>( watched ) )
{
if ( event->type() == QEvent::WindowActivate )
{
QgsDebugError( QStringLiteral( "activated %1" ).arg( widget->canvasName() ) );
}
else if ( event->type() == QEvent::FocusIn )
{
QgsDebugError( QStringLiteral( "focused %1" ).arg( widget->canvasName() ) );
}
else if ( event->type() == QEvent::MouseButtonPress )
{
QgsDebugError( QStringLiteral( "pressed %1" ).arg( widget->canvasName() ) );
}
}
return QObject::eventFilter( watched, event );
}
10 changes: 10 additions & 0 deletions src/app/3d/qgs3dmapcanvaswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ class QgsMapCanvas;
class QgsDockableWidgetHelper;
class QgsRubberBand;

class Qgs3dMapCanvasInputBridge : public QObject
{
public:
Qgs3dMapCanvasInputBridge( QObject* parent );

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


};

class APP_EXPORT Qgs3DMapCanvasWidget : public QWidget
{
Q_OBJECT
Expand Down
6 changes: 6 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13124,6 +13124,12 @@ Qgs3DMapCanvasWidget *QgisApp::createNew3DMapCanvasDock( const QString &name, bo

Qgs3DMapCanvasWidget *widget = new Qgs3DMapCanvasWidget( name, isDocked );

if ( !m3dMapCanvasInputBridge )
{
m3dMapCanvasInputBridge = new Qgs3dMapCanvasInputBridge( this );
}
widget->installEventFilter( m3dMapCanvasInputBridge );

mOpen3DMapViews.insert( widget );
widget->setMainCanvas( mMapCanvas );
widget->mapCanvas3D()->setTemporalController( mTemporalControllerWidget->temporalController() );
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class QgsAppGpsConnection;
class QgsGpsToolBar;
class QgsAppGpsSettingsMenu;
class Qgs3DMapScene;
class Qgs3dMapCanvasInputBridge;

#include <QMainWindow>
#include <QToolBar>
Expand Down Expand Up @@ -2732,6 +2733,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

#ifdef HAVE_3D
QSet<Qgs3DMapCanvasWidget *> mOpen3DMapViews;
Qgs3dMapCanvasInputBridge* m3dMapCanvasInputBridge = nullptr;
#endif

//! True if the autoSelectAddedLayer() slot should not be doing anything (performance optimization when adding a lot of layers)
Expand Down

0 comments on commit f5bfbf5

Please sign in to comment.