QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsoptionswidgetfactory.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsoptionswidgetfactory.h
3
-------------------------------
4
Date : March 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 QGSOPTIONSWIDGETFACTORY_H
17
#define QGSOPTIONSWIDGETFACTORY_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsoptionsdialoghighlightwidget.h
"
22
23
#include <QListWidgetItem>
24
30
class
GUI_EXPORT
QgsOptionsPageWidget
:
public
QWidget
31
{
32
Q_OBJECT
33
34
public
:
38
QgsOptionsPageWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
)
39
: QWidget( parent )
40
{}
41
52
virtual
QString
helpKey
()
const
{
return
QString(); }
53
58
QHash<QWidget *, QgsOptionsDialogHighlightWidget *>
registeredHighlightWidgets
()
SIP_SKIP
{
return
mHighlightWidgets; }
59
69
virtual
bool
isValid
() {
return
true
; }
70
71
public
slots:
72
77
virtual
void
apply
() = 0;
78
83
virtual
void
cancel
() {
return
; }
84
85
protected
:
91
void
registerHighlightWidget
(
QgsOptionsDialogHighlightWidget
*highlightWidget ) { mHighlightWidgets.insert( highlightWidget->
widget
(), highlightWidget ); }
92
93
private
:
94
QHash<QWidget *, QgsOptionsDialogHighlightWidget *> mHighlightWidgets;
95
};
96
102
// NOTE - this is a QObject so we can detect its destruction and avoid
103
// QGIS crashing when a plugin crashes/exits without deregistering a factory
104
class
GUI_EXPORT
QgsOptionsWidgetFactory
:
public
QObject
105
{
106
Q_OBJECT
107
108
public
:
109
QgsOptionsWidgetFactory
() =
default
;
110
112
QgsOptionsWidgetFactory
(
const
QString &
title
,
const
QIcon &
icon
,
const
QString &
key
= QString() )
113
: mTitle(
title
)
114
, mIcon(
icon
)
115
, mKey(
key
)
116
{}
117
123
virtual
QIcon
icon
()
const
{
return
mIcon; }
124
129
void
setIcon
(
const
QIcon &
icon
) { mIcon =
icon
; }
130
135
virtual
QString
title
()
const
{
return
mTitle; }
136
141
void
setTitle
(
const
QString &
title
) { mTitle =
title
; }
142
149
virtual
QString
key
()
const
{
return
mKey; }
150
155
void
setKey
(
const
QString &
key
) { mKey =
key
; }
156
169
virtual
QString
pagePositionHint
()
const
{
return
QString(); }
170
180
virtual
QStringList
path
()
const
{
return
QStringList(); }
181
187
virtual
QgsOptionsPageWidget
*
createWidget
( QWidget *parent =
nullptr
)
const
= 0
SIP_FACTORY
;
188
189
private
:
190
QString mTitle;
191
QIcon mIcon;
192
QString mKey;
193
};
194
195
#endif
// QGSOPTIONSWIDGETFACTORY_H
QgsOptionsDialogHighlightWidget
Container for a widget to be used to search text in the option dialog.
Definition
qgsoptionsdialoghighlightwidget.h:65
QgsOptionsDialogHighlightWidget::widget
QWidget * widget()
Returns the widget.
Definition
qgsoptionsdialoghighlightwidget.h:91
QgsOptionsPageWidget
Base class for widgets for pages included in the options dialog.
Definition
qgsoptionswidgetfactory.h:31
QgsOptionsPageWidget::QgsOptionsPageWidget
QgsOptionsPageWidget(QWidget *parent=nullptr)
Constructor for QgsOptionsPageWidget.
Definition
qgsoptionswidgetfactory.h:38
QgsOptionsPageWidget::registeredHighlightWidgets
QHash< QWidget *, QgsOptionsDialogHighlightWidget * > registeredHighlightWidgets()
Returns the registered highlight widgets used to search and highlight text in options dialogs.
Definition
qgsoptionswidgetfactory.h:58
QgsOptionsPageWidget::registerHighlightWidget
void registerHighlightWidget(QgsOptionsDialogHighlightWidget *highlightWidget)
Register a highlight widget to be used to search and highlight text in options dialogs.
Definition
qgsoptionswidgetfactory.h:91
QgsOptionsPageWidget::helpKey
virtual QString helpKey() const
Returns the optional help key for the options page.
Definition
qgsoptionswidgetfactory.h:52
QgsOptionsPageWidget::cancel
virtual void cancel()
Called to cancel settings changed in the options page (e.g.
Definition
qgsoptionswidgetfactory.h:83
QgsOptionsPageWidget::isValid
virtual bool isValid()
Validates the current state of the widget.
Definition
qgsoptionswidgetfactory.h:69
QgsOptionsPageWidget::apply
virtual void apply()=0
Called to permanently apply the settings shown in the options page (e.g.
QgsOptionsWidgetFactory::setKey
void setKey(const QString &key)
Set the key for the interface.
Definition
qgsoptionswidgetfactory.h:155
QgsOptionsWidgetFactory::setTitle
void setTitle(const QString &title)
Set the title for the interface.
Definition
qgsoptionswidgetfactory.h:141
QgsOptionsWidgetFactory::QgsOptionsWidgetFactory
QgsOptionsWidgetFactory(const QString &title, const QIcon &icon, const QString &key=QString())
Constructor.
Definition
qgsoptionswidgetfactory.h:112
QgsOptionsWidgetFactory::setIcon
void setIcon(const QIcon &icon)
Set the icon to show in the interface for the factory object.
Definition
qgsoptionswidgetfactory.h:129
QgsOptionsWidgetFactory::path
virtual QStringList path() const
Returns the path to place the widget page at, for options dialogs which are structured using a tree v...
Definition
qgsoptionswidgetfactory.h:180
QgsOptionsWidgetFactory::createWidget
virtual QgsOptionsPageWidget * createWidget(QWidget *parent=nullptr) const =0
Factory function to create the widget on demand as needed by the options dialog.
QgsOptionsWidgetFactory::key
virtual QString key() const
The key of the panel (untranslated title).
Definition
qgsoptionswidgetfactory.h:149
QgsOptionsWidgetFactory::icon
virtual QIcon icon() const
The icon that will be shown in the UI for the panel.
Definition
qgsoptionswidgetfactory.h:123
QgsOptionsWidgetFactory::title
virtual QString title() const
The title of the panel.
Definition
qgsoptionswidgetfactory.h:135
QgsOptionsWidgetFactory::pagePositionHint
virtual QString pagePositionHint() const
Returns a tab name hinting at where this page should be inserted into the options properties tab list...
Definition
qgsoptionswidgetfactory.h:169
QgsOptionsWidgetFactory::QgsOptionsWidgetFactory
QgsOptionsWidgetFactory()=default
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
qgsoptionsdialoghighlightwidget.h
Generated on
for QGIS API Documentation by
1.17.0