Skip to content
Permalink
Browse files
QgsSettingsTree widget refresh setting list on show
  • Loading branch information
domi4484 committed Apr 26, 2021
1 parent 1def5e7 commit 79393b628421a174d0413cd0bc6519dfbdec7726
Showing with 27 additions and 15 deletions.
  1. +20 −15 src/app/qgssettingstree.cpp
  2. +1 −0 src/app/qgssettingstree.h
  3. +6 −0 src/core/settings/qgssettingsentry.cpp
@@ -48,6 +48,7 @@
#include "qgssettingsentry.h"
#include "qgssettingsregistrycore.h"
#include "qgsapplication.h"
#include "qgsguiutils.h"

#include <QMenu>
#include <QMessageBox>
@@ -80,14 +81,14 @@ QgsSettingsTree::QgsSettingsTree( QWidget *parent )

void QgsSettingsTree::setSettingsObject( QgsSettings *settings )
{
delete this->mSettings;
this->mSettings = settings;
mSettings = settings;
clear();

if ( settings )
if ( mSettings )
{
settings->setParent( this );
refresh();
mSettings->setParent( this );
if ( isVisible() )
refresh();
if ( mAutoRefresh )
mRefreshTimer.start();
}
@@ -104,18 +105,16 @@ QSize QgsSettingsTree::sizeHint() const

void QgsSettingsTree::setAutoRefresh( bool autoRefresh )
{
this->mAutoRefresh = autoRefresh;
if ( mSettings )
mAutoRefresh = autoRefresh;
if ( mAutoRefresh )
{
if ( autoRefresh )
{
maybeRefresh();
maybeRefresh();
if ( mSettings )
mRefreshTimer.start();
}
else
{
mRefreshTimer.stop();
}
}
else
{
mRefreshTimer.stop();
}
}

@@ -162,6 +161,12 @@ bool QgsSettingsTree::event( QEvent *event )
return QTreeWidget::event( event );
}

void QgsSettingsTree::showEvent( QShowEvent * )
{
QgsTemporaryCursorOverride waitCursor( Qt::BusyCursor );
refresh();
}

void QgsSettingsTree::updateSetting( QTreeWidgetItem *item )
{
QString key = itemKey( item );
@@ -83,6 +83,7 @@ class QgsSettingsTree : public QTreeWidget

protected:
bool event( QEvent *event ) override;
void showEvent( QShowEvent * ) override;

private slots:
void updateSetting( QTreeWidgetItem *item );
@@ -85,6 +85,12 @@ QString QgsSettingsEntryBase::key( const QStringList &dynamicKeyPartList ) const

bool QgsSettingsEntryBase::keyIsValid( const QString &key ) const
{
if ( !hasDynamicKey() )
{
if ( !key.contains( definitionKey() ) )
return false;
}

// Key to check
QString completeKeyToCheck = key;

0 comments on commit 79393b6

Please sign in to comment.