Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[layout] Added template method to retrieve QgsLayoutObjects
- Loading branch information
Showing
with
28 additions
and
0 deletions.
-
+1
−0
python/core/layout/qgslayout.sip
-
+27
−0
src/core/layout/qgslayout.h
|
@@ -87,6 +87,7 @@ Returns the items model attached to the layout. |
|
|
%End |
|
|
|
|
|
|
|
|
|
|
|
QList<QgsLayoutItem *> selectedLayoutItems( const bool includeLockedItems = true ); |
|
|
%Docstring |
|
|
Returns list of selected layout items. |
|
|
|
@@ -133,6 +133,33 @@ class CORE_EXPORT QgsLayout : public QGraphicsScene, public QgsExpressionContext |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* Returns a list of layout objects (items and multiframes) of a specific type. |
|
|
* \note not available in Python bindings |
|
|
*/ |
|
|
template<class T> void layoutObjects( QList<T *> &objectList ) const SIP_SKIP |
|
|
{ |
|
|
objectList.clear(); |
|
|
const QList<QGraphicsItem *> itemList( items() ); |
|
|
const QList<QgsLayoutMultiFrame *> frameList( multiFrames() ); |
|
|
for ( const auto &obj : itemList ) |
|
|
{ |
|
|
T *item = dynamic_cast<T *>( obj ); |
|
|
if ( item ) |
|
|
{ |
|
|
objectList.push_back( item ); |
|
|
} |
|
|
} |
|
|
for ( const auto &obj : frameList ) |
|
|
{ |
|
|
T *item = dynamic_cast<T *>( obj ); |
|
|
if ( item ) |
|
|
{ |
|
|
objectList.push_back( item ); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* Returns list of selected layout items. |
|
|
* |
|
|