mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6743 Dock Widgets : Workaround for high CPU usage
This commit is contained in:
parent
f3f7ea55c0
commit
64e4ee9402
@ -263,6 +263,50 @@ QVariant RiuDockWidgetTools::defaultDockWidgetVisibilities()
|
|||||||
return QVariant( widgetVisibilitiesForEclipse() );
|
return QVariant( widgetVisibilitiesForEclipse() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Qwt widgets in non-visible dock widgets (tabbed dock windows) will on some systems enter an
|
||||||
|
/// eternal update loop. This is seen on both Windows and Linux.
|
||||||
|
/// The workaround is to hide all dock widgets, and then set visible the docking windows seen to
|
||||||
|
/// trigger the unwanted behavior
|
||||||
|
///
|
||||||
|
/// https://github.com/OPM/ResInsight/issues/6743
|
||||||
|
/// https://github.com/OPM/ResInsight/issues/6627
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuDockWidgetTools::workaroundForQwtDockWidgets()
|
||||||
|
{
|
||||||
|
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||||
|
|
||||||
|
QList<QDockWidget*> dockWidgets = mainWindow->findChildren<QDockWidget*>();
|
||||||
|
dockWidgets.removeAll( nullptr );
|
||||||
|
|
||||||
|
for ( QDockWidget* dock : dockWidgets )
|
||||||
|
{
|
||||||
|
dock->setVisible( false );
|
||||||
|
}
|
||||||
|
QApplication::processEvents();
|
||||||
|
|
||||||
|
{
|
||||||
|
auto dock = findDockWidget( mainWindow, relPermPlotName() );
|
||||||
|
if ( dock )
|
||||||
|
{
|
||||||
|
dock->setVisible( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto dock = findDockWidget( mainWindow, pvtPlotName() );
|
||||||
|
if ( dock )
|
||||||
|
{
|
||||||
|
dock->setVisible( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QApplication::processEvents();
|
||||||
|
|
||||||
|
mainWindow->restoreDockWidgetVisibilities();
|
||||||
|
mainWindow->loadWinGeoAndDockToolBarLayout();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
static QVariant dockWidgetsVisibility( const QObject* parent );
|
static QVariant dockWidgetsVisibility( const QObject* parent );
|
||||||
static QVariant defaultDockWidgetVisibilities();
|
static QVariant defaultDockWidgetVisibilities();
|
||||||
|
|
||||||
|
static void workaroundForQwtDockWidgets();
|
||||||
|
|
||||||
static void setVisibleDockingWindowsForEclipse();
|
static void setVisibleDockingWindowsForEclipse();
|
||||||
static void setVisibleDockingWindowsForGeoMech();
|
static void setVisibleDockingWindowsForGeoMech();
|
||||||
|
|
||||||
|
@ -154,6 +154,11 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
m_memoryRefreshTimer = new QTimer( this );
|
m_memoryRefreshTimer = new QTimer( this );
|
||||||
connect( m_memoryRefreshTimer, SIGNAL( timeout() ), this, SLOT( updateMemoryUsage() ) );
|
connect( m_memoryRefreshTimer, SIGNAL( timeout() ), this, SLOT( updateMemoryUsage() ) );
|
||||||
m_memoryRefreshTimer->start( 1000 );
|
m_memoryRefreshTimer->start( 1000 );
|
||||||
|
|
||||||
|
auto dockTimer = new QTimer( this );
|
||||||
|
dockTimer->setSingleShot( true );
|
||||||
|
connect( dockTimer, SIGNAL( timeout() ), this, SLOT( slotWorkaroundForQwtDockWidgets() ) );
|
||||||
|
dockTimer->start( 1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1968,6 +1973,14 @@ void RiuMainWindow::customMenuRequested( const QPoint& pos )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuMainWindow::slotWorkaroundForQwtDockWidgets()
|
||||||
|
{
|
||||||
|
RiuDockWidgetTools::workaroundForQwtDockWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -236,6 +236,8 @@ private slots:
|
|||||||
void selectedObjectsChanged();
|
void selectedObjectsChanged();
|
||||||
void customMenuRequested( const QPoint& pos );
|
void customMenuRequested( const QPoint& pos );
|
||||||
|
|
||||||
|
void slotWorkaroundForQwtDockWidgets();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void selectViewInProjectTreePreservingSubItemSelection( const Rim3dView* previousActiveReservoirView,
|
void selectViewInProjectTreePreservingSubItemSelection( const Rim3dView* previousActiveReservoirView,
|
||||||
Rim3dView* activatedView );
|
Rim3dView* activatedView );
|
||||||
|
Loading…
Reference in New Issue
Block a user