QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 
106  QgsLayoutItem *item( int index ) const;
107 
111  QgsLayoutItem *currentItem() const;
112 
113  public slots:
114 
118  void setItem( const QgsLayoutItem *item );
119 
120  signals:
121 
123  void itemChanged( QgsLayoutItem *item );
124 
125  private slots:
126  void indexChanged( int i );
127  void rowsChanged();
128 
129  private:
130  std::unique_ptr< QgsLayoutProxyModel > mProxyModel;
131 
132 };
133 
134 #endif // QGSLAYOUTITEMCOMBOBOX_H
Base class for graphical items within a QgsLayout.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
The QgsLayoutItemComboBox class is a combo box which displays items of a matching type from a layout...
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:49