@@ -71,19 +71,20 @@ QgsLayoutLocatorFilter::QgsLayoutLocatorFilter( QObject *parent )
71
71
72
72
void QgsLayoutLocatorFilter::fetchResults ( const QString &string, const QgsLocatorContext &, QgsFeedback *feedback )
73
73
{
74
- Q_FOREACH ( QgsComposition *composition, QgsProject::instance ()->layoutManager ()->compositions () )
74
+ const QList< QgsMasterLayoutInterface * > layouts = QgsProject::instance ()->layoutManager ()->layouts ();
75
+ for ( QgsMasterLayoutInterface *layout : layouts )
75
76
{
76
77
if ( feedback->isCanceled () )
77
78
return ;
78
79
79
- if ( composition && stringMatches ( composition ->name (), string ) )
80
+ if ( layout && stringMatches ( layout ->name (), string ) )
80
81
{
81
82
QgsLocatorResult result;
82
83
result.filter = this ;
83
- result.displayString = composition ->name ();
84
- result.userData = composition ->name ();
84
+ result.displayString = layout ->name ();
85
+ result.userData = layout ->name ();
85
86
// result.icon = QgsMapLayerModel::iconForLayer( layer->layer() );
86
- result.score = static_cast < double >( string.length () ) / composition ->name ().length ();
87
+ result.score = static_cast < double >( string.length () ) / layout ->name ().length ();
87
88
emit resultFetched ( result );
88
89
}
89
90
}
@@ -92,11 +93,11 @@ void QgsLayoutLocatorFilter::fetchResults( const QString &string, const QgsLocat
92
93
void QgsLayoutLocatorFilter::triggerResult ( const QgsLocatorResult &result )
93
94
{
94
95
QString layoutName = result.userData .toString ();
95
- QgsComposition *composition = QgsProject::instance ()->layoutManager ()->compositionByName ( layoutName );
96
- if ( !composition )
96
+ QgsMasterLayoutInterface *layout = QgsProject::instance ()->layoutManager ()->layoutByName ( layoutName );
97
+ if ( !layout )
97
98
return ;
98
99
99
- QgisApp::instance ()->openComposer ( composition );
100
+ QgisApp::instance ()->openLayoutDesignerDialog ( layout );
100
101
}
101
102
102
103
0 commit comments