-// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "PVViewer_ViewManager.h"
#include "PVViewer_ViewModel.h"
#endif // DISABLE_PVVIEWER
+#ifndef DISABLE_PV3DVIEWER
+#include "PV3DViewer_ViewManager.h"
+#include "PV3DViewer_ViewModel.h"
+#endif // DISABLE_PV3DVIEWER
#include "QtxActionMenuMgr.h"
#include "QtxWorkstack.h"
#include "QtxTreeView.h"
\internal
*/
const char* DEFAULT_SECTION = "SalomePyQt";
+
+ struct Activator
+ {
+ QWidget* myActiveWindow;
+ QWidget* myFocusedWidget;
+ Activator()
+ {
+ myActiveWindow = QApplication::activeWindow();
+ myFocusedWidget = QApplication::focusWidget();
+ QApplication::setActiveWindow( getApplication()->desktop() );
+ }
+ ~Activator()
+ {
+ if ( myActiveWindow )
+ QApplication::setActiveWindow( myActiveWindow );
+ if ( myFocusedWidget )
+ myFocusedWidget->setFocus();
+ }
+ };
}
/*!
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
+ Activator activator;
myResult = anApp->activateModule( myModuleName );
}
}
myResult = true;
}
#endif // DISABLE_PVVIEWER
+ }
+ else if ( type == "ParaView3D") {
+#ifndef DISABLE_PV3DVIEWER
+ // specific processing for ParaView3D viewer:
+ // hierarchy of ParaView3D viewer is much more complex than for usual view;
+ // we look for sub-widget named "Viewport"
+ QList<QWidget*> lst = wnd->findChildren<QWidget*>( "Viewport" );
+ if ( !lst.isEmpty() ) {
+ lst[0]->resize( myWndWidth, myWndHeight );
+ myResult = true;
+ }
+#endif // DISABLE_PV3DVIEWER
}
else {
if ( wnd->centralWidget() ) {
SUIT_ViewWindow* wnd = getWnd( myWndId );
MESSAGE("window id:" << myWndId << " SUIT_ViewWindow*: " << wnd);
if ( wnd ) {
+ Activator activator;
wnd->setFocus();
myResult = true;
}
};
ProcessVoidEvent( new TEvent() );
}
+
+/*!
+ \brief Log GUI event.
+ \param eventDescription GUI event description.
+*/
+void SalomePyQt::logUserEvent( const QString& eventDescription )
+{
+ class TEvent: public SALOME_Event
+ {
+ QString myEventDescription;
+ public:
+ TEvent( const QString& theDescription ) : myEventDescription( theDescription ) {}
+ virtual void Execute()
+ {
+ LightApp_Application::logUserEvent( myEventDescription );
+ }
+ };
+ ProcessVoidEvent( new TEvent( eventDescription ) );
+}
+
+/*!
+ \brief Log given action.
+ \param action GUI action being logged.
+ \param moduleName optional name of module, owning an action
+*/
+void SalomePyQt::logAction( QAction* action, const QString& moduleName )
+{
+ class TEvent: public SALOME_Event
+ {
+ QAction* myAction;
+ QString myModuleName;
+ public:
+ TEvent( QAction* theAction, const QString& theModuleName ) : myAction( theAction ), myModuleName( theModuleName ) {}
+ virtual void Execute()
+ {
+ LightApp_Application::logAction( myAction, myModuleName );
+ }
+ };
+ ProcessVoidEvent( new TEvent( action, moduleName ) );
+}