@@ -60,37 +60,35 @@ QgsSettingsTree::QgsSettingsTree( QWidget *parent )
60
60
header ()->resizeSection ( 1 , 100 );
61
61
header ()->resizeSection ( 2 , 250 );
62
62
63
- settings = nullptr ;
64
- refreshTimer.setInterval ( 2000 );
65
- autoRefresh = false ;
63
+ mRefreshTimer .setInterval ( 2000 );
66
64
67
- groupIcon .addPixmap ( style ()->standardPixmap ( QStyle::SP_DirClosedIcon ),
68
- QIcon::Normal, QIcon::Off );
69
- groupIcon .addPixmap ( style ()->standardPixmap ( QStyle::SP_DirOpenIcon ),
70
- QIcon::Normal, QIcon::On );
71
- keyIcon = style ()->standardIcon ( QStyle::SP_FileIcon );
65
+ mGroupIcon .addPixmap ( style ()->standardPixmap ( QStyle::SP_DirClosedIcon ),
66
+ QIcon::Normal, QIcon::Off );
67
+ mGroupIcon .addPixmap ( style ()->standardPixmap ( QStyle::SP_DirOpenIcon ),
68
+ QIcon::Normal, QIcon::On );
69
+ mKeyIcon = style ()->standardIcon ( QStyle::SP_FileIcon );
72
70
73
71
setEditTriggers ( QAbstractItemView::AllEditTriggers );
74
72
75
- connect ( &refreshTimer , &QTimer::timeout, this , &QgsSettingsTree::maybeRefresh );
73
+ connect ( &mRefreshTimer , &QTimer::timeout, this , &QgsSettingsTree::maybeRefresh );
76
74
}
77
75
78
76
void QgsSettingsTree::setSettingsObject ( QgsSettings *settings )
79
77
{
80
- delete this ->settings ;
81
- this ->settings = settings;
78
+ delete this ->mSettings ;
79
+ this ->mSettings = settings;
82
80
clear ();
83
81
84
82
if ( settings )
85
83
{
86
84
settings->setParent ( this );
87
85
refresh ();
88
- if ( autoRefresh )
89
- refreshTimer .start ();
86
+ if ( mAutoRefresh )
87
+ mRefreshTimer .start ();
90
88
}
91
89
else
92
90
{
93
- refreshTimer .stop ();
91
+ mRefreshTimer .stop ();
94
92
}
95
93
}
96
94
@@ -101,17 +99,17 @@ QSize QgsSettingsTree::sizeHint() const
101
99
102
100
void QgsSettingsTree::setAutoRefresh ( bool autoRefresh )
103
101
{
104
- this ->autoRefresh = autoRefresh;
105
- if ( settings )
102
+ this ->mAutoRefresh = autoRefresh;
103
+ if ( mSettings )
106
104
{
107
105
if ( autoRefresh )
108
106
{
109
107
maybeRefresh ();
110
- refreshTimer .start ();
108
+ mRefreshTimer .start ();
111
109
}
112
110
else
113
111
{
114
- refreshTimer .stop ();
112
+ mRefreshTimer .stop ();
115
113
}
116
114
}
117
115
}
@@ -124,21 +122,21 @@ void QgsSettingsTree::maybeRefresh()
124
122
125
123
void QgsSettingsTree::refresh ()
126
124
{
127
- if ( !settings )
125
+ if ( !mSettings )
128
126
return ;
129
127
130
128
disconnect ( this , &QTreeWidget::itemChanged,
131
129
this , &QgsSettingsTree::updateSetting );
132
130
133
- settings ->sync ();
131
+ mSettings ->sync ();
134
132
135
133
// add any settings not in QgsSettings object, so it will show up in the tree view
136
- QMap<QString, QStringList>::const_iterator it = settingsMap .constBegin ();
137
- while ( it != settingsMap .constEnd () )
134
+ QMap<QString, QStringList>::const_iterator it = mSettingsMap .constBegin ();
135
+ while ( it != mSettingsMap .constEnd () )
138
136
{
139
- if ( ! settings ->contains ( it.key () ) )
137
+ if ( ! mSettings ->contains ( it.key () ) )
140
138
{
141
- settings ->setValue ( it.key (), it.value ().at ( 3 ) );
139
+ mSettings ->setValue ( it.key (), it.value ().at ( 3 ) );
142
140
}
143
141
++it;
144
142
}
@@ -153,7 +151,7 @@ bool QgsSettingsTree::event( QEvent *event )
153
151
{
154
152
if ( event->type () == QEvent::WindowActivate )
155
153
{
156
- if ( isActiveWindow () && autoRefresh )
154
+ if ( isActiveWindow () && mAutoRefresh )
157
155
maybeRefresh ();
158
156
}
159
157
return QTreeWidget::event ( event );
@@ -165,16 +163,16 @@ void QgsSettingsTree::updateSetting( QTreeWidgetItem *item )
165
163
if ( key.isNull () )
166
164
return ;
167
165
168
- settings ->setValue ( key, item->data ( 2 , Qt::UserRole ) );
169
- if ( autoRefresh )
166
+ mSettings ->setValue ( key, item->data ( 2 , Qt::UserRole ) );
167
+ if ( mAutoRefresh )
170
168
refresh ();
171
169
}
172
170
173
171
void QgsSettingsTree::updateChildItems ( QTreeWidgetItem *parent )
174
172
{
175
173
int dividerIndex = 0 ;
176
174
177
- Q_FOREACH ( const QString &group, settings ->childGroups () )
175
+ Q_FOREACH ( const QString &group, mSettings ->childGroups () )
178
176
{
179
177
QTreeWidgetItem *child = nullptr ;
180
178
int childIndex = findChild ( parent, group, dividerIndex );
@@ -190,15 +188,15 @@ void QgsSettingsTree::updateChildItems( QTreeWidgetItem *parent )
190
188
{
191
189
child = createItem ( group, parent, dividerIndex );
192
190
}
193
- child->setIcon ( 0 , groupIcon );
191
+ child->setIcon ( 0 , mGroupIcon );
194
192
++dividerIndex;
195
193
196
- settings ->beginGroup ( group );
194
+ mSettings ->beginGroup ( group );
197
195
updateChildItems ( child );
198
- settings ->endGroup ();
196
+ mSettings ->endGroup ();
199
197
}
200
198
201
- Q_FOREACH ( const QString &key, settings ->childKeys () )
199
+ Q_FOREACH ( const QString &key, mSettings ->childKeys () )
202
200
{
203
201
QTreeWidgetItem *child = nullptr ;
204
202
int childIndex = findChild ( parent, key, 0 );
@@ -216,15 +214,15 @@ void QgsSettingsTree::updateChildItems( QTreeWidgetItem *parent )
216
214
{
217
215
child = createItem ( key, parent, dividerIndex );
218
216
}
219
- child->setIcon ( 0 , keyIcon );
217
+ child->setIcon ( 0 , mKeyIcon );
220
218
++dividerIndex;
221
219
}
222
220
else
223
221
{
224
222
child = childAt ( parent, childIndex );
225
223
}
226
224
227
- QVariant value = settings ->value ( key );
225
+ QVariant value = mSettings ->value ( key );
228
226
if ( value.type () == QVariant::Invalid )
229
227
{
230
228
child->setText ( 1 , QStringLiteral ( " Invalid" ) );
@@ -259,10 +257,10 @@ QTreeWidgetItem *QgsSettingsTree::createItem( const QString &text,
259
257
260
258
QString key = itemKey ( item );
261
259
QgsDebugMsgLevel ( key, 4 );
262
- if ( settingsMap .contains ( key ) )
260
+ if ( mSettingsMap .contains ( key ) )
263
261
{
264
- QgsDebugMsgLevel ( " contains!!!!" , 4 );
265
- QStringList values = settingsMap [ key ];
262
+ QgsDebugMsgLevel ( QStringLiteral ( " contains!!!!" ) , 4 );
263
+ QStringList values = mSettingsMap [ key ];
266
264
item->setText ( 3 , values.at ( 0 ) );
267
265
item->setToolTip ( 0 , values.at ( 1 ) );
268
266
item->setToolTip ( 2 , values.at ( 1 ) );
0 commit comments