/
qgslayoutmanagerdialog.cpp
642 lines (557 loc) · 20.2 KB
/
qgslayoutmanagerdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
/***************************************************************************
qgslayoutmanagerdialog.cpp
-----------------------
begin : December 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgslayoutmanagerdialog.h"
#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgsbusyindicatordialog.h"
#include "qgslayoutdesignerdialog.h"
#include "qgslayout.h"
#include "qgslogger.h"
#include "qgssettings.h"
#include "qgslayoutview.h"
#include "qgslayoutmanager.h"
#include "qgsproject.h"
#include "qgsgui.h"
#include "qgsprintlayout.h"
#include "qgsreport.h"
#include <QDesktopServices>
#include <QDialog>
#include <QDir>
#include <QFileDialog>
#include <QInputDialog>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QUrl>
QgsLayoutManagerDialog::QgsLayoutManagerDialog( QWidget *parent, Qt::WindowFlags f ): QDialog( parent, f )
{
setupUi( this );
connect( mAddButton, &QPushButton::clicked, this, &QgsLayoutManagerDialog::mAddButton_clicked );
connect( mTemplate, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManagerDialog::mTemplate_currentIndexChanged );
connect( mTemplatesDefaultDirBtn, &QPushButton::pressed, this, &QgsLayoutManagerDialog::mTemplatesDefaultDirBtn_pressed );
connect( mTemplatesUserDirBtn, &QPushButton::pressed, this, &QgsLayoutManagerDialog::mTemplatesUserDirBtn_pressed );
QgsGui::instance()->enableAutoGeometryRestore( this );
mTemplateFileWidget->setStorageMode( QgsFileWidget::GetFile );
mTemplateFileWidget->setFilter( tr( "Layout templates" ) + QStringLiteral( " (*.qpt *.QPT)" ) );
mTemplateFileWidget->setDialogTitle( tr( "Select a Template" ) );
mTemplateFileWidget->lineEdit()->setShowClearButton( false );
QgsSettings settings;
mTemplateFileWidget->setDefaultRoot( settings.value( QStringLiteral( "UI/lastComposerTemplateDir" ), QString() ).toString() );
mTemplateFileWidget->setFilePath( settings.value( QStringLiteral( "UI/ComposerManager/templatePath" ), QString() ).toString() );
connect( mTemplateFileWidget, &QgsFileWidget::fileChanged, this, [ = ]
{
QgsSettings settings;
settings.setValue( QStringLiteral( "UI/ComposerManager/templatePath" ), mTemplateFileWidget->filePath() );
QFileInfo tmplFileInfo( mTemplateFileWidget->filePath() );
settings.setValue( QStringLiteral( "UI/lastComposerTemplateDir" ), tmplFileInfo.absolutePath() );
} );
mModel = new QgsLayoutManagerModel( QgsProject::instance()->layoutManager(),
this );
mProxyModel = new QgsLayoutManagerProxyModel( mLayoutListView );
mProxyModel->setSourceModel( mModel );
mLayoutListView->setModel( mProxyModel );
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QWidget::close );
connect( mLayoutListView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &QgsLayoutManagerDialog::toggleButtons );
connect( mLayoutListView, &QListView::doubleClicked, this, &QgsLayoutManagerDialog::itemDoubleClicked );
mShowButton = mButtonBox->addButton( tr( "&Show" ), QDialogButtonBox::ActionRole );
connect( mShowButton, &QAbstractButton::clicked, this, &QgsLayoutManagerDialog::showClicked );
mCreateReportButton = mButtonBox->addButton( tr( "Create &Report" ), QDialogButtonBox::ActionRole );
connect( mCreateReportButton, &QAbstractButton::clicked, this, &QgsLayoutManagerDialog::createReport );
mDuplicateButton = mButtonBox->addButton( tr( "&Duplicate" ), QDialogButtonBox::ActionRole );
connect( mDuplicateButton, &QAbstractButton::clicked, this, &QgsLayoutManagerDialog::duplicateClicked );
mRemoveButton = mButtonBox->addButton( tr( "&Remove" ), QDialogButtonBox::ActionRole );
connect( mRemoveButton, &QAbstractButton::clicked, this, &QgsLayoutManagerDialog::removeClicked );
mRenameButton = mButtonBox->addButton( tr( "Re&name" ), QDialogButtonBox::ActionRole );
connect( mRenameButton, &QAbstractButton::clicked, this, &QgsLayoutManagerDialog::renameClicked );
#ifdef Q_OS_MAC
// Create action to select this window
mWindowAction = new QAction( windowTitle(), this );
connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
#endif
mTemplate->addItem( tr( "Empty layout" ) );
mTemplate->addItem( tr( "Specific" ) );
mUserTemplatesDir = QgsApplication::qgisSettingsDirPath() + "/composer_templates";
QMap<QString, QString> userTemplateMap = defaultTemplates( true );
this->addTemplates( userTemplateMap );
mDefaultTemplatesDir = QgsApplication::pkgDataPath() + "/composer_templates";
QMap<QString, QString> defaultTemplateMap = defaultTemplates( false );
this->addTemplates( defaultTemplateMap );
this->addTemplates( this->otherTemplates() );
toggleButtons();
}
void QgsLayoutManagerDialog::toggleButtons()
{
// Nothing selected: no button.
if ( mLayoutListView->selectionModel()->selectedRows().isEmpty() )
{
mShowButton->setEnabled( false );
mRemoveButton->setEnabled( false );
mRenameButton->setEnabled( false );
mDuplicateButton->setEnabled( false );
}
// toggle everything if one layout is selected
else if ( mLayoutListView->selectionModel()->selectedRows().count() == 1 )
{
mShowButton->setEnabled( true );
mRemoveButton->setEnabled( true );
mRenameButton->setEnabled( true );
mDuplicateButton->setEnabled( true );
}
// toggle only show and remove buttons in other cases
else
{
mShowButton->setEnabled( true );
mRemoveButton->setEnabled( true );
mRenameButton->setEnabled( false );
mDuplicateButton->setEnabled( false );
}
}
void QgsLayoutManagerDialog::addTemplates( const QMap<QString, QString> &templates )
{
if ( !templates.isEmpty() )
{
mTemplate->insertSeparator( mTemplate->count() );
QMap<QString, QString>::const_iterator templateIt = templates.constBegin();
for ( ; templateIt != templates.constEnd(); ++templateIt )
{
mTemplate->addItem( templateIt.key(), templateIt.value() );
}
}
}
void QgsLayoutManagerDialog::activate()
{
raise();
setWindowState( windowState() & ~Qt::WindowMinimized );
activateWindow();
}
QMap<QString, QString> QgsLayoutManagerDialog::defaultTemplates( bool fromUser ) const
{
//search for default templates in $pkgDataPath/composer_templates
// user templates in $qgisSettingsDirPath/composer_templates
return templatesFromPath( fromUser ? mUserTemplatesDir : mDefaultTemplatesDir );
}
QMap<QString, QString> QgsLayoutManagerDialog::otherTemplates() const
{
QMap<QString, QString> templateMap;
QStringList paths = QgsApplication::composerTemplatePaths();
Q_FOREACH ( const QString &path, paths )
{
QMap<QString, QString> templates = templatesFromPath( path );
QMap<QString, QString>::const_iterator templateIt = templates.constBegin();
for ( ; templateIt != templates.constEnd(); ++templateIt )
{
templateMap.insert( templateIt.key(), templateIt.value() );
}
}
return templateMap;
}
QMap<QString, QString> QgsLayoutManagerDialog::templatesFromPath( const QString &path ) const
{
QMap<QString, QString> templateMap;
QDir templateDir( path );
if ( !templateDir.exists() )
{
return templateMap;
}
QFileInfoList fileInfoList = templateDir.entryInfoList( QDir::Files );
QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
{
if ( infoIt->suffix().toLower() == QLatin1String( "qpt" ) )
{
templateMap.insert( infoIt->baseName(), infoIt->absoluteFilePath() );
}
}
return templateMap;
}
void QgsLayoutManagerDialog::mAddButton_clicked()
{
QFile templateFile;
bool loadingTemplate = ( mTemplate->currentIndex() > 0 );
QDomDocument templateDoc;
QString storedTitle;
if ( loadingTemplate )
{
if ( mTemplate->currentIndex() == 1 )
{
templateFile.setFileName( mTemplateFileWidget->filePath() );
}
else
{
templateFile.setFileName( mTemplate->currentData().toString() );
}
if ( !templateFile.exists() )
{
QMessageBox::warning( this, tr( "Create layout" ), tr( "Template file “%1” not found." ).arg( templateFile.fileName() ) );
return;
}
if ( !templateFile.open( QIODevice::ReadOnly ) )
{
QMessageBox::warning( this, tr( "Create layout" ), tr( "Could not read template file “%1”." ).arg( templateFile.fileName() ) );
return;
}
if ( templateDoc.setContent( &templateFile, false ) )
{
QDomElement layoutElem = templateDoc.documentElement();
if ( !layoutElem.isNull() )
storedTitle = layoutElem.attribute( "name" );
}
}
QString title;
if ( !QgisApp::instance()->uniqueLayoutTitle( this, title, true, QgsMasterLayoutInterface::PrintLayout, storedTitle ) )
{
return;
}
if ( title.isEmpty() )
{
title = QgsProject::instance()->layoutManager()->generateUniqueTitle();
}
std::unique_ptr< QgsPrintLayout > layout = qgis::make_unique< QgsPrintLayout >( QgsProject::instance() );
if ( loadingTemplate )
{
bool loadedOK = false;
( void )layout->loadFromTemplate( templateDoc, QgsReadWriteContext(), true, &loadedOK );
if ( !loadedOK )
{
QMessageBox::warning( this, tr( "Create layout" ), tr( "Invalid template file “%1”." ).arg( templateFile.fileName() ) );
layout.reset();
}
}
else
{
layout->initializeDefaults();
}
if ( layout )
{
layout->setName( title );
QgisApp::instance()->openLayoutDesignerDialog( layout.get() );
QgsProject::instance()->layoutManager()->addLayout( layout.release() );
}
}
void QgsLayoutManagerDialog::mTemplate_currentIndexChanged( int indx )
{
bool specific = ( indx == 1 ); // comes just after empty template
mTemplateFileWidget->setEnabled( specific );
}
void QgsLayoutManagerDialog::mTemplatesDefaultDirBtn_pressed()
{
openLocalDirectory( mDefaultTemplatesDir );
}
void QgsLayoutManagerDialog::mTemplatesUserDirBtn_pressed()
{
openLocalDirectory( mUserTemplatesDir );
}
void QgsLayoutManagerDialog::createReport()
{
QString title;
if ( !QgisApp::instance()->uniqueLayoutTitle( this, title, true, QgsMasterLayoutInterface::Report ) )
{
return;
}
if ( title.isEmpty() )
{
title = QgsProject::instance()->layoutManager()->generateUniqueTitle();
}
std::unique_ptr< QgsReport > report = qgis::make_unique< QgsReport >( QgsProject::instance() );
report->setName( title );
std::unique_ptr< QgsLayout > header = qgis::make_unique< QgsLayout >( QgsProject::instance() );
header->initializeDefaults();
report->setHeader( header.release() );
report->setHeaderEnabled( true );
QgisApp::instance()->openLayoutDesignerDialog( report.get() );
QgsProject::instance()->layoutManager()->addLayout( report.release() );
}
void QgsLayoutManagerDialog::openLocalDirectory( const QString &localDirPath )
{
QDir localDir;
if ( !localDir.mkpath( localDirPath ) )
{
QMessageBox::warning( this, tr( "Open directory" ), tr( "Could not open or create local directory “%1”." ).arg( localDirPath ) );
}
else
{
QDesktopServices::openUrl( QUrl::fromLocalFile( localDirPath ) );
}
}
#ifdef Q_OS_MAC
void QgsLayoutManagerDialog::showEvent( QShowEvent *event )
{
if ( !event->spontaneous() )
{
QgisApp::instance()->addWindow( mWindowAction );
}
}
void QgsLayoutManagerDialog::changeEvent( QEvent *event )
{
QDialog::changeEvent( event );
switch ( event->type() )
{
case QEvent::ActivationChange:
if ( QApplication::activeWindow() == this )
{
mWindowAction->setChecked( true );
}
break;
default:
break;
}
}
#endif
void QgsLayoutManagerDialog::removeClicked()
{
const QModelIndexList layoutItems = mLayoutListView->selectionModel()->selectedRows();
if ( layoutItems.isEmpty() )
{
return;
}
QString title;
QString message;
if ( layoutItems.count() == 1 )
{
title = tr( "Remove layout" );
message = tr( "Do you really want to remove the print layout “%1”?" ).arg(
mLayoutListView->model()->data( layoutItems.at( 0 ), Qt::DisplayRole ).toString() );
}
else
{
title = tr( "Remove layouts" );
message = tr( "Do you really want to remove all selected print layouts?" );
}
if ( QMessageBox::warning( this, title, message, QMessageBox::Ok | QMessageBox::Cancel ) != QMessageBox::Ok )
{
return;
}
QList<QgsMasterLayoutInterface *> layoutList;
// Find the layouts that need to be deleted
for ( const QModelIndex &index : layoutItems )
{
QgsMasterLayoutInterface *l = mModel->layoutFromIndex( mProxyModel->mapToSource( index ) );
if ( l )
{
layoutList << l;
}
}
// Once we have the layout list, we can delete all of them !
for ( QgsMasterLayoutInterface *l : qgis::as_const( layoutList ) )
{
QgsProject::instance()->layoutManager()->removeLayout( l );
}
}
void QgsLayoutManagerDialog::showClicked()
{
const QModelIndexList layoutItems = mLayoutListView->selectionModel()->selectedRows();
for ( const QModelIndex &index : layoutItems )
{
if ( QgsMasterLayoutInterface *l = mModel->layoutFromIndex( mProxyModel->mapToSource( index ) ) )
{
QgisApp::instance()->openLayoutDesignerDialog( l );
}
}
}
void QgsLayoutManagerDialog::duplicateClicked()
{
if ( mLayoutListView->selectionModel()->selectedRows().isEmpty() )
{
return;
}
QgsMasterLayoutInterface *currentLayout = mModel->layoutFromIndex( mProxyModel->mapToSource( mLayoutListView->selectionModel()->selectedRows().at( 0 ) ) );
if ( !currentLayout )
return;
QString currentTitle = currentLayout->name();
QString newTitle;
if ( !QgisApp::instance()->uniqueLayoutTitle( this, newTitle, false, currentLayout->layoutType(), tr( "%1 copy" ).arg( currentTitle ) ) )
{
return;
}
// provide feedback, since loading of template into duplicate layout will be hidden
QDialog *dlg = new QgsBusyIndicatorDialog( tr( "Duplicating layout…" ) );
dlg->setStyleSheet( QgisApp::instance()->styleSheet() );
dlg->show();
QgsLayoutDesignerDialog *newDialog = QgisApp::instance()->duplicateLayout( currentLayout, newTitle );
dlg->close();
delete dlg;
dlg = nullptr;
if ( !newDialog )
{
QMessageBox::warning( this, tr( "Duplicate layout" ),
tr( "Layout duplication failed." ) );
}
else
{
newDialog->activate();
}
}
void QgsLayoutManagerDialog::renameClicked()
{
if ( mLayoutListView->selectionModel()->selectedRows().isEmpty() )
{
return;
}
QgsMasterLayoutInterface *currentLayout = mModel->layoutFromIndex( mProxyModel->mapToSource( mLayoutListView->selectionModel()->selectedRows().at( 0 ) ) );
if ( !currentLayout )
return;
QString currentTitle = currentLayout->name();
QString newTitle;
if ( !QgisApp::instance()->uniqueLayoutTitle( this, newTitle, false, currentLayout->layoutType(), currentTitle ) )
{
return;
}
currentLayout->setName( newTitle );
}
void QgsLayoutManagerDialog::itemDoubleClicked( const QModelIndex &index )
{
if ( QgsMasterLayoutInterface *l = mModel->layoutFromIndex( mProxyModel->mapToSource( index ) ) )
{
QgisApp::instance()->openLayoutDesignerDialog( l );
}
}
//
// QgsLayoutManagerModel
//
QgsLayoutManagerModel::QgsLayoutManagerModel( QgsLayoutManager *manager, QObject *parent )
: QAbstractListModel( parent )
, mLayoutManager( manager )
{
connect( mLayoutManager, &QgsLayoutManager::layoutAboutToBeAdded, this, &QgsLayoutManagerModel::layoutAboutToBeAdded );
connect( mLayoutManager, &QgsLayoutManager::layoutAdded, this, &QgsLayoutManagerModel::layoutAdded );
connect( mLayoutManager, &QgsLayoutManager::layoutAboutToBeRemoved, this, &QgsLayoutManagerModel::layoutAboutToBeRemoved );
connect( mLayoutManager, &QgsLayoutManager::layoutRemoved, this, &QgsLayoutManagerModel::layoutRemoved );
connect( mLayoutManager, &QgsLayoutManager::layoutRenamed, this, &QgsLayoutManagerModel::layoutRenamed );
}
int QgsLayoutManagerModel::rowCount( const QModelIndex &parent ) const
{
Q_UNUSED( parent );
return mLayoutManager->layouts().count();
}
QVariant QgsLayoutManagerModel::data( const QModelIndex &index, int role ) const
{
if ( index.row() < 0 || index.row() >= rowCount( QModelIndex() ) )
return QVariant();
switch ( role )
{
case Qt::DisplayRole:
case Qt::ToolTipRole:
case Qt::EditRole:
return mLayoutManager->layouts().at( index.row() )->name();
case LayoutRole:
{
if ( QgsLayout *l = dynamic_cast< QgsLayout * >( mLayoutManager->layouts().at( index.row() ) ) )
return QVariant::fromValue( l );
else if ( QgsReport *r = dynamic_cast< QgsReport * >( mLayoutManager->layouts().at( index.row() ) ) )
return QVariant::fromValue( r );
else
return QVariant();
}
case Qt::DecorationRole:
{
return mLayoutManager->layouts().at( index.row() )->icon();
}
default:
return QVariant();
}
}
bool QgsLayoutManagerModel::setData( const QModelIndex &index, const QVariant &value, int role )
{
if ( !index.isValid() || role != Qt::EditRole )
{
return false;
}
if ( index.row() >= mLayoutManager->layouts().count() )
{
return false;
}
if ( value.toString().isEmpty() )
return false;
QgsMasterLayoutInterface *layout = layoutFromIndex( index );
if ( !layout )
return false;
//has name changed?
bool changed = layout->name() != value.toString();
if ( !changed )
return true;
//check if name already exists
QStringList layoutNames;
const QList< QgsMasterLayoutInterface * > layouts = QgsProject::instance()->layoutManager()->layouts();
for ( QgsMasterLayoutInterface *l : layouts )
{
layoutNames << l->name();
}
if ( layoutNames.contains( value.toString() ) )
{
//name exists!
QMessageBox::warning( nullptr, tr( "Rename layout" ), tr( "There is already a layout named “%1”." ).arg( value.toString() ) );
return false;
}
layout->setName( value.toString() );
return true;
}
Qt::ItemFlags QgsLayoutManagerModel::flags( const QModelIndex &index ) const
{
Qt::ItemFlags flags = QAbstractListModel::flags( index );
#if 0 // double-click is now used for opening the layout
if ( index.isValid() )
{
return flags | Qt::ItemIsEditable;
}
else
{
return flags;
}
#endif
return flags;
}
QgsMasterLayoutInterface *QgsLayoutManagerModel::layoutFromIndex( const QModelIndex &index ) const
{
if ( QgsPrintLayout *l = qobject_cast< QgsPrintLayout * >( qvariant_cast<QObject *>( data( index, LayoutRole ) ) ) )
return l;
else if ( QgsReport *r = qobject_cast< QgsReport * >( qvariant_cast<QObject *>( data( index, LayoutRole ) ) ) )
return r;
else
return nullptr;
}
void QgsLayoutManagerModel::layoutAboutToBeAdded( const QString & )
{
int row = mLayoutManager->layouts().count();
beginInsertRows( QModelIndex(), row, row );
}
void QgsLayoutManagerModel::layoutAboutToBeRemoved( const QString &name )
{
QgsMasterLayoutInterface *l = mLayoutManager->layoutByName( name );
int row = mLayoutManager->layouts().indexOf( l );
if ( row >= 0 )
beginRemoveRows( QModelIndex(), row, row );
}
void QgsLayoutManagerModel::layoutAdded( const QString & )
{
endInsertRows();
}
void QgsLayoutManagerModel::layoutRemoved( const QString & )
{
endRemoveRows();
}
void QgsLayoutManagerModel::layoutRenamed( QgsMasterLayoutInterface *layout, const QString & )
{
int row = mLayoutManager->layouts().indexOf( layout );
QModelIndex index = createIndex( row, 0 );
emit dataChanged( index, index, QVector<int>() << Qt::DisplayRole );
}
QgsLayoutManagerProxyModel::QgsLayoutManagerProxyModel( QObject *parent )
: QSortFilterProxyModel( parent )
{
setDynamicSortFilter( true );
sort( 0 );
setSortCaseSensitivity( Qt::CaseInsensitive );
}