QGIS API Documentation 3.41.0-Master (af5edcb665c)
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 QgsOptionsProxyModel( QObject *parent );
53
54 void setPageHidden( int page, bool hidden );
55 QModelIndex pageNumberToSourceIndex( int page ) const;
56 int sourceIndexToPageNumber( const QModelIndex &index ) const;
57 bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override;
58
59 private:
60 QMap<int, bool> mHiddenPages;
61};
63#endif
64
65
85class GUI_EXPORT QgsOptionsDialogBase : public QDialog
86{
87 Q_OBJECT
88
89 public:
97 QgsOptionsDialogBase( const QString &settingsKey, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = Qt::WindowFlags(), QgsSettings *settings = nullptr );
98 ~QgsOptionsDialogBase() override;
99
105 void initOptionsBase( bool restoreUi = true, const QString &title = QString() );
106
107 // set custom QgsSettings pointer if dialog used outside QGIS (in plugin)
108 void setSettings( QgsSettings *settings );
109
115 void restoreOptionsBaseUi( const QString &title = QString() );
116
122 void restoreLastPage();
123
129 void resizeAlltabs( int index );
130
134 bool iconOnly() { return mIconOnly; }
135
141 void setCurrentPage( const QString &page );
142
159 void addPage( const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget SIP_TRANSFER, const QStringList &path = QStringList(), const QString &key = QString() );
160
180 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() );
181
182 public slots:
183
188 void searchText( const QString &text );
189
190 protected slots:
192 virtual void updateOptionsListVerticalTabs();
194 virtual void optionsStackedWidget_CurrentChanged( int index );
196 virtual void optionsStackedWidget_WidgetRemoved( int index );
197
198 void warnAboutMissingObjects();
199
200 protected:
201 void showEvent( QShowEvent *e ) override;
202 void paintEvent( QPaintEvent *e ) override;
203
204 virtual void updateWindowTitle();
205
210 void registerTextSearchWidgets();
211
217 QStandardItem *createItem( const QString &name, const QString &tooltip, const QString &icon ) SIP_SKIP;
218
219 QList<QPair<QgsOptionsDialogHighlightWidget *, int>> mRegisteredSearchWidgets;
220
221 QString mOptsKey;
222 bool mInit = false;
223 QListWidget *mOptListWidget = nullptr;
224 QTreeView *mOptTreeView = nullptr;
225 QStandardItemModel *mOptTreeModel = nullptr;
226 QgsOptionsProxyModel *mTreeProxyModel = nullptr;
227
228 QStackedWidget *mOptStackedWidget = nullptr;
229 QSplitter *mOptSplitter = nullptr;
230 QDialogButtonBox *mOptButtonBox = nullptr;
231 QgsFilterLineEdit *mSearchLineEdit = nullptr;
233 bool mIconOnly = false;
234 // pointer to app or custom, external QgsSettings
235 // QPointer in case custom settings obj gets deleted while dialog is open
236 QPointer<QgsSettings> mSettings;
237 bool mDelSettings = false;
238
239 private:
240 void setListToItemAtIndex( int index );
241};
242
243#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:64
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36