Skip to content
Permalink
Browse files

Non-leaky approach to singleshot timer

  • Loading branch information
nyalldawson committed Oct 7, 2020
1 parent 6da6a45 commit 6abe3b6dd5e6e1b641711fda21dd1970b92a70bd
Showing with 4 additions and 8 deletions.
  1. +4 −6 src/app/qgisappinterface.cpp
  2. +0 −2 src/app/qgisappinterface.h
@@ -780,12 +780,10 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b

void QgisAppInterface::preloadForm( const QString &uifile )
{
mTimer = new QTimer( this );

connect( mTimer, &QTimer::timeout, mTimer, &QTimer::stop );
connect( mTimer, &QTimer::timeout, this, [ = ] { cacheloadForm( uifile ); } );

mTimer->start( 0 );
QTimer::singleShot( 0, this, [ = ]
{
cacheloadForm( uifile );
} );
}

void QgisAppInterface::cacheloadForm( const QString &uifile )
@@ -325,8 +325,6 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
//! Pointer to the QgisApp object
QgisApp *qgis = nullptr;

QTimer *mTimer = nullptr;

//! Pointer to the PluginManagerInterface object
QgsAppPluginManagerInterface pluginManagerIface;
};

0 comments on commit 6abe3b6

Please sign in to comment.
You can’t perform that action at this time.