QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
30 class QDialogButtonBox;
31 class QListWidget;
32 class QModelIndex;
33 class QPalette;
34 class QPainter;
35 class QStackedWidget;
36 class QStyleOptionViewItem;
37 class QSplitter;
38 
39 class QgsFilterLineEdit;
41 
42 
62 class GUI_EXPORT QgsOptionsDialogBase : public QDialog
63 {
64  Q_OBJECT
65 
66  public:
67 
75  QgsOptionsDialogBase( const QString &settingsKey, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = nullptr, QgsSettings *settings = nullptr );
76  ~QgsOptionsDialogBase() override;
77 
83  void initOptionsBase( bool restoreUi = true, const QString &title = QString() );
84 
85  // set custom QgsSettings pointer if dialog used outside QGIS (in plugin)
86  void setSettings( QgsSettings *settings );
87 
93  void restoreOptionsBaseUi( const QString &title = QString() );
94 
100  void restoreLastPage();
101 
107  void resizeAlltabs( int index );
108 
112  bool iconOnly() {return mIconOnly;}
113 
119  void setCurrentPage( const QString &page );
120 
131  void addPage( const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget SIP_TRANSFER );
132 
146  void insertPage( const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget SIP_TRANSFER, const QString &before );
147 
148  public slots:
149 
155  void searchText( const QString &text );
156 
157  protected slots:
159  virtual void updateOptionsListVerticalTabs();
161  virtual void optionsStackedWidget_CurrentChanged( int index );
163  virtual void optionsStackedWidget_WidgetRemoved( int index );
164 
165  void warnAboutMissingObjects();
166 
167  protected:
168  void showEvent( QShowEvent *e ) override;
169  void paintEvent( QPaintEvent *e ) override;
170 
171  virtual void updateWindowTitle();
172 
178  void registerTextSearchWidgets();
179 
180  QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets;
181 
182  QString mOptsKey;
183  bool mInit;
184  QListWidget *mOptListWidget = nullptr;
185  QStackedWidget *mOptStackedWidget = nullptr;
186  QSplitter *mOptSplitter = nullptr;
187  QDialogButtonBox *mOptButtonBox = nullptr;
188  QgsFilterLineEdit *mSearchLineEdit = nullptr;
189  QString mDialogTitle;
190  bool mIconOnly;
191  // pointer to app or custom, external QgsSettings
192  // QPointer in case custom settings obj gets deleted while dialog is open
193  QPointer<QgsSettings> mSettings;
195 };
196 
197 #endif // QGSOPTIONSDIALOGBASE_H
QgsOptionsDialogBase
Definition: qgsoptionsdialogbase.h:62
QgsOptionsDialogHighlightWidget
Definition: qgsoptionsdialoghighlightwidget.h:35
QgsFilterLineEdit
Definition: qgsfilterlineedit.h:39
QgsSettings
Definition: qgssettings.h:61
QgsOptionsDialogBase::mDelSettings
bool mDelSettings
Definition: qgsoptionsdialogbase.h:194
QgsOptionsDialogBase::mIconOnly
bool mIconOnly
Definition: qgsoptionsdialogbase.h:190
QgsOptionsDialogBase::mSettings
QPointer< QgsSettings > mSettings
Definition: qgsoptionsdialogbase.h:193
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsOptionsDialogBase::iconOnly
bool iconOnly()
Determine if the options list is in icon only mode.
Definition: qgsoptionsdialogbase.h:112
QgsOptionsDialogBase::mDialogTitle
QString mDialogTitle
Definition: qgsoptionsdialogbase.h:189
QgsOptionsDialogBase::mOptsKey
QString mOptsKey
Definition: qgsoptionsdialogbase.h:182
qgssettings.h
QgsOptionsDialogBase::mInit
bool mInit
Definition: qgsoptionsdialogbase.h:183
QgsOptionsDialogBase::mRegisteredSearchWidgets
QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets
Definition: qgsoptionsdialogbase.h:180
qgsguiutils.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53