QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgslayoutitemcombobox.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutitemcombobox.h
3  --------------------------------------
4  Date : October 2017
5  Copyright : (C) 2017 Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15 
16 #ifndef QGSLAYOUTITEMCOMBOBOX_H
17 #define QGSLAYOUTITEMCOMBOBOX_H
18 
19 #include <QComboBox>
20 #include "qgis_sip.h"
21 #include "qgslayoutitem.h"
22 #include "qgslayoutitemregistry.h"
23 #include "qgis_gui.h"
24 #include "qgslayoutmodel.h"
25 
26 
34 class GUI_EXPORT QgsLayoutItemComboBox : public QComboBox
35 {
36  Q_OBJECT
37 
38  public:
39 
46  explicit QgsLayoutItemComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsLayout *layout = nullptr );
47 
53  void setCurrentLayout( QgsLayout *layout );
54 
60  QgsLayout *currentLayout();
61 
68  void setItemType( QgsLayoutItemRegistry::ItemType itemType );
69 
74  QgsLayoutItemRegistry::ItemType itemType() const;
75 
80  void setExceptedItemList( const QList< QgsLayoutItem * > &exceptList );
81 
86  QList< QgsLayoutItem * > exceptedItemList() const;
87 
93  void setAllowEmptyItem( bool allowEmpty );
94 
100  bool allowEmptyItem() const;
101 
110  void setItemFlags( QgsLayoutItem::Flags flags );
111 
120  QgsLayoutItem::Flags itemFlags() const;
121 
126  QgsLayoutItem *item( int index ) const;
127 
131  QgsLayoutItem *currentItem() const;
132 
133  public slots:
134 
138  void setItem( const QgsLayoutItem *item );
139 
140  signals:
141 
143  void itemChanged( QgsLayoutItem *item );
144 
145  private slots:
146  void indexChanged( int i );
147  void rowsChanged();
148 
149  private:
150  std::unique_ptr< QgsLayoutProxyModel > mProxyModel;
151 
152 };
153 
154 #endif // QGSLAYOUTITEMCOMBOBOX_H
The QgsLayoutItemComboBox class is a combo box which displays items of a matching type from a layout.
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
Base class for graphical items within a QgsLayout.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:50
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53