@@ -47,11 +47,14 @@ QgsOptionsDialogBase::~QgsOptionsDialogBase()
47
47
}
48
48
}
49
49
50
- void QgsOptionsDialogBase::initOptionsBase ( bool restoreUi )
50
+ void QgsOptionsDialogBase::initOptionsBase ( bool restoreUi, QString title )
51
51
{
52
- // save original dialog title so it can be used to be concatenated
52
+ // save dialog title so it can be used to be concatenated
53
53
// with category title in icon-only mode
54
- mDialogTitle = windowTitle ();
54
+ if ( title.isEmpty () )
55
+ mDialogTitle = windowTitle ();
56
+ else
57
+ mDialogTitle = title;
55
58
56
59
// don't add to dialog margins
57
60
// redefine now, or those in inherited .ui file will be added
@@ -109,16 +112,22 @@ void QgsOptionsDialogBase::initOptionsBase( bool restoreUi )
109
112
mInit = true ;
110
113
111
114
if ( restoreUi )
112
- restoreOptionsBaseUi ();
115
+ restoreOptionsBaseUi ( mDialogTitle );
113
116
}
114
117
115
- void QgsOptionsDialogBase::restoreOptionsBaseUi ()
118
+ void QgsOptionsDialogBase::restoreOptionsBaseUi ( QString title )
116
119
{
117
120
if ( !mInit )
118
121
{
119
122
return ;
120
123
}
121
124
125
+ if ( !title.isEmpty () )
126
+ {
127
+ mDialogTitle = title;
128
+ updateWindowTitle ();
129
+ }
130
+
122
131
// re-save original dialog title in case it was changed after dialog initialization
123
132
mDialogTitle = windowTitle ();
124
133
@@ -179,6 +188,19 @@ void QgsOptionsDialogBase::paintEvent( QPaintEvent* e )
179
188
QDialog::paintEvent ( e );
180
189
}
181
190
191
+ void QgsOptionsDialogBase::updateWindowTitle ()
192
+ {
193
+ QListWidgetItem *curitem = mOptListWidget ->currentItem ();
194
+ if ( curitem )
195
+ {
196
+ setWindowTitle ( QString ( " %1 | %2" ).arg ( mDialogTitle ).arg ( curitem->text () ) );
197
+ }
198
+ else
199
+ {
200
+ setWindowTitle ( mDialogTitle );
201
+ }
202
+ }
203
+
182
204
void QgsOptionsDialogBase::updateOptionsListVerticalTabs ()
183
205
{
184
206
if ( !mInit )
@@ -221,15 +243,7 @@ void QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( int indx )
221
243
mOptListWidget ->setCurrentRow ( indx );
222
244
mOptListWidget ->blockSignals ( false );
223
245
224
- QListWidgetItem *curitem = mOptListWidget ->currentItem ();
225
- if ( curitem )
226
- {
227
- setWindowTitle ( QString ( " %1 - %2" ).arg ( mDialogTitle ).arg ( curitem->text () ) );
228
- }
229
- else
230
- {
231
- setWindowTitle ( mDialogTitle );
232
- }
246
+ updateWindowTitle ();
233
247
}
234
248
235
249
void QgsOptionsDialogBase::optionsStackedWidget_WidgetRemoved ( int indx )
0 commit comments