QGIS API Documentation  3.13.0-Master (740be229cb)
qgssubstitutionlistwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssubstitutionlistwidget.h
3  ---------------------------
4  begin : August 2016
5  copyright : (C) 2016 Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7 
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #ifndef QGSSUBSTITUTIONLISTWIDGET_H
19 #define QGSSUBSTITUTIONLISTWIDGET_H
20 
21 #include <QDialog>
22 #include "qgis_sip.h"
23 #include "qgspanelwidget.h"
24 #include "ui_qgssubstitutionlistwidgetbase.h"
25 #include "qgsstringutils.h"
26 #include "qgis_gui.h"
27 
36 class GUI_EXPORT QgsSubstitutionListWidget : public QgsPanelWidget, private Ui::QgsSubstitutionListWidgetBase
37 {
38  Q_OBJECT
39  Q_PROPERTY( QgsStringReplacementCollection substitutions READ substitutions WRITE setSubstitutions NOTIFY substitutionsChanged )
40 
41  public:
42 
47  QgsSubstitutionListWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
48 
54  void setSubstitutions( const QgsStringReplacementCollection &substitutions );
55 
60  QgsStringReplacementCollection substitutions() const;
61 
62  signals:
63 
65  void substitutionsChanged( const QgsStringReplacementCollection &substitutions );
66 
67  private slots:
68 
69  void mButtonAdd_clicked();
70  void mButtonRemove_clicked();
71  void tableChanged();
72  void mButtonExport_clicked();
73  void mButtonImport_clicked();
74 
75  private:
76 
77  void addSubstitution( const QgsStringReplacement &substitution );
78 
79 };
80 
89 class GUI_EXPORT QgsSubstitutionListDialog : public QDialog
90 {
91  Q_OBJECT
92  Q_PROPERTY( QgsStringReplacementCollection substitutions READ substitutions WRITE setSubstitutions )
93 
94  public:
95 
100  QgsSubstitutionListDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr );
101 
107  void setSubstitutions( const QgsStringReplacementCollection &substitutions );
108 
113  QgsStringReplacementCollection substitutions() const;
114 
115 
116  private:
117 
118  QgsSubstitutionListWidget *mWidget = nullptr;
119 
120 };
121 
122 #endif // QGSSUBSTITUTIONLISTWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
A representation of a single string replacement.
Base class for any widget that can be shown as a inline panel.
A widget which allows users to specify a list of substitutions to apply to a string, with options for exporting and importing substitution lists.
A collection of string replacements (specified using QgsStringReplacement objects).
A dialog which allows users to specify a list of substitutions to apply to a string, with options for exporting and importing substitution lists.