QGIS API Documentation  3.2.0-Bonn (bc43194)
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 
61 class GUI_EXPORT QgsOptionsDialogBase : public QDialog
62 {
63  Q_OBJECT
64 
65  public:
66 
74  QgsOptionsDialogBase( const QString &settingsKey, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = nullptr, QgsSettings *settings = nullptr );
75  ~QgsOptionsDialogBase() override;
76 
82  void initOptionsBase( bool restoreUi = true, const QString &title = QString() );
83 
84  // set custom QgsSettings pointer if dialog used outside QGIS (in plugin)
85  void setSettings( QgsSettings *settings );
86 
92  void restoreOptionsBaseUi( const QString &title = QString() );
93 
97  bool iconOnly() {return mIconOnly;}
98 
99  public slots:
100 
106  void searchText( const QString &text );
107 
108  protected slots:
110  virtual void updateOptionsListVerticalTabs();
112  virtual void optionsStackedWidget_CurrentChanged( int index );
114  virtual void optionsStackedWidget_WidgetRemoved( int index );
115 
116  void warnAboutMissingObjects();
117 
118  protected:
119  void showEvent( QShowEvent *e ) override;
120  void paintEvent( QPaintEvent *e ) override;
121 
122  virtual void updateWindowTitle();
123 
129  void registerTextSearchWidgets();
130 
131  QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets;
132 
133  QString mOptsKey;
134  bool mInit;
135  QListWidget *mOptListWidget = nullptr;
136  QStackedWidget *mOptStackedWidget = nullptr;
137  QSplitter *mOptSplitter = nullptr;
138  QDialogButtonBox *mOptButtonBox = nullptr;
139  QgsFilterLineEdit *mSearchLineEdit = nullptr;
140  QString mDialogTitle;
141  bool mIconOnly;
142  // pointer to app or custom, external QgsSettings
143  // QPointer in case custom settings obj gets deleted while dialog is open
144  QPointer<QgsSettings> mSettings;
146 };
147 
148 #endif // QGSOPTIONSDIALOGBASE_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
This class is a composition of two QSettings instances:
Definition: qgssettings.h:58
QList< QPair< QgsOptionsDialogHighlightWidget *, int > > mRegisteredSearchWidgets
QLineEdit subclass with built in support for clearing the widget&#39;s value and handling custom null val...
A base dialog for options and properties dialogs that offers vertical tabs.
Container for a widget to be used to search text in the option dialog If the widget type is handled...
QPointer< QgsSettings > mSettings
bool iconOnly()
Determine if the options list is in icon only mode.