QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsoptionsdialogbase.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsoptionsdialogbase.h - base vertical tabs option dialog
3
4 ---------------------
5 begin : March 24, 2013
6 copyright : (C) 2013 by Larry Shaffer
7 email : larrys at dakcarto dot com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSOPTIONSDIALOGBASE_H
18#define QGSOPTIONSDIALOGBASE_H
19
20#include "qgsguiutils.h"
21#include "qgssettings.h"
22#include "qgis_gui.h"
23
24#include <functional>
25
26#include <QDialog>
27#include <QPointer>
28#include <QStyledItemDelegate>
29#include <QSortFilterProxyModel>
30
31class QDialogButtonBox;
32class QListWidget;
33class QModelIndex;
34class QPalette;
35class QPainter;
36class QStackedWidget;
37class QStyleOptionViewItem;
38class QSplitter;
39class QStandardItem;
40class QTreeView;
41class QStandardItemModel;
42
45
46#ifndef SIP_RUN
48class GUI_EXPORT QgsOptionsProxyModel : public QSortFilterProxyModel
49{
50 Q_OBJECT
51 public:
52
53 QgsOptionsProxyModel( QObject *parent );
54
55 void setPageHidden( int page, bool hidden );
56 QModelIndex pageNumberToSourceIndex( int page ) const;
57 int sourceIndexToPageNumber( const QModelIndex &index ) const;
58 bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override;
59
60 private:
61 QMap< int, bool > mHiddenPages;
62};
64#endif
65
66
86class GUI_EXPORT QgsOptionsDialogBase : public QDialog
87{
88 Q_OBJECT
89
90 public:
91
99 QgsOptionsDialogBase( const QString &settingsKey, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = Qt::WindowFlags(), QgsSettings *settings = nullptr );
100 ~QgsOptionsDialogBase() override;
101
107 void initOptionsBase( bool restoreUi = true, const QString &title = QString() );
108
109 // set custom QgsSettings pointer if dialog used outside QGIS (in plugin)
110 void setSettings( QgsSettings *settings );
111
117 void restoreOptionsBaseUi( const QString &title = QString() );
118
124 void restoreLastPage();
125
131 void resizeAlltabs( int index );
132
136 bool iconOnly() {return mIconOnly;}
137
143 void setCurrentPage( const QString &page );
144
161 void addPage( const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget SIP_TRANSFER, const QStringList &path = QStringList(), const QString &key = QString() );
162
182 void insertPage( const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget SIP_TRANSFER, const QString &before, const QStringList &path = QStringList(), const QString &key = QString() );
183
184 public slots:
185
191 void searchText( const QString &text );
192
193 protected slots:
195 virtual void updateOptionsListVerticalTabs();
197 virtual void optionsStackedWidget_CurrentChanged( int index );
199 virtual void optionsStackedWidget_WidgetRemoved( int index );
200
201 void warnAboutMissingObjects();
202
203 protected:
204 void showEvent( QShowEvent *e ) override;
205 void paintEvent( QPaintEvent *e ) override;
206
207 virtual void updateWindowTitle();
208
214 void registerTextSearchWidgets();
215
221 QStandardItem *createItem( const QString &name, const QString &tooltip, const QString &icon ) SIP_SKIP;
222
223 QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets;
224
225 QString mOptsKey;
226 bool mInit = false;
227 QListWidget *mOptListWidget = nullptr;
228 QTreeView *mOptTreeView = nullptr;
229 QStandardItemModel *mOptTreeModel = nullptr;
230 QgsOptionsProxyModel *mTreeProxyModel = nullptr;
231
232 QStackedWidget *mOptStackedWidget = nullptr;
233 QSplitter *mOptSplitter = nullptr;
234 QDialogButtonBox *mOptButtonBox = nullptr;
235 QgsFilterLineEdit *mSearchLineEdit = nullptr;
237 bool mIconOnly = false;
238 // pointer to app or custom, external QgsSettings
239 // QPointer in case custom settings obj gets deleted while dialog is open
240 QPointer<QgsSettings> mSettings;
241 bool mDelSettings = false;
242
243 private:
244
245 void setListToItemAtIndex( int index );
246
247};
248
249#endif // QGSOPTIONSDIALOGBASE_H
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
A base dialog for options and properties dialogs that offers vertical tabs.
QPointer< QgsSettings > mSettings
QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets
bool iconOnly()
Determine if the options list is in icon only mode.
Container for a widget to be used to search text in the option dialog If the widget type is handled,...
This class is a composition of two QSettings instances:
Definition qgssettings.h:63
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36