QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgslayoutitem.h"
23#include "qgslayoutmodel.h"
24
25#include <QComboBox>
26
32class GUI_EXPORT QgsLayoutItemComboBox : public QComboBox
33{
34 Q_OBJECT
35
36 public:
37
44 explicit QgsLayoutItemComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsLayout *layout = nullptr );
45
51 void setCurrentLayout( QgsLayout *layout );
52
59
67
73
78 void setExceptedItemList( const QList<QgsLayoutItem *> &exceptList );
79
84 QList<QgsLayoutItem *> exceptedItemList() const;
85
91 void setAllowEmptyItem( bool allowEmpty );
92
98 bool allowEmptyItem() const;
99
109
119
124 QgsLayoutItem *item( int index ) const;
125
129 QgsLayoutItem *currentItem() const;
130
131 public slots:
132
136 void setItem( const QgsLayoutItem *item );
137
138 signals:
139
142
143 private slots:
144 void indexChanged( int i );
145 void rowsChanged();
146
147 private:
148 std::unique_ptr<QgsLayoutProxyModel> mProxyModel;
149};
150
151#endif // QGSLAYOUTITEMCOMBOBOX_H
QgsLayoutItem * item(int index) const
Returns the item currently shown at the specified index within the combo box.
void setCurrentLayout(QgsLayout *layout)
Sets the layout containing the items to list in the combo box.
QgsLayout * currentLayout()
Returns the current layout containing the items shown in the combo box.
void setExceptedItemList(const QList< QgsLayoutItem * > &exceptList)
Sets a list of specific items to exclude from the combo box.
QgsLayoutItem * currentItem() const
Returns the item currently selected in the combo box.
QgsLayoutItemRegistry::ItemType itemType() const
Returns the filter for the item types to show in the combo box.
void setItemType(QgsLayoutItemRegistry::ItemType itemType)
Sets a filter for the item type to show in the combo box.
QgsLayoutItemComboBox(QWidget *parent=nullptr, QgsLayout *layout=nullptr)
QgsLayoutItemComboBox creates a combo box to display a list of items in a layout.
void setAllowEmptyItem(bool allowEmpty)
Sets whether an optional empty layout item is present in the combobox.
void setItem(const QgsLayoutItem *item)
Sets the currently selected item in the combo box.
QgsLayoutItem::Flags itemFlags() const
Returns the layout item flags used for filtering the available items.
bool allowEmptyItem() const
Returns true if the model includes the empty item choice.
void setItemFlags(QgsLayoutItem::Flags flags)
Sets layout item flags to use for filtering the available items.
QList< QgsLayoutItem * > exceptedItemList() const
Returns the list of specific items excluded from the combo box.
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
Base class for graphical items within a QgsLayout.
QFlags< Flag > Flags
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