QGIS API Documentation
4.3.0-Master (0ad0cdb9438)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsstoredquerymanager.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsstoredquerymanager.h
3
----------------------------------
4
Date : February 2025
5
Copyright : (C) 2025 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 QGSSTOREDQUERYMANAGER_H
17
#define QGSSTOREDQUERYMANAGER_H
18
19
#include "
qgis.h
"
20
#include "qgis_gui.h"
21
#include "
qgssettingstree.h
"
22
23
#include <QString>
24
25
using namespace
Qt::StringLiterals;
26
36
class
GUI_EXPORT
QgsStoredQueryManager
:
public
QObject
37
{
38
Q_OBJECT
39
40
public
:
41
#ifndef SIP_RUN
43
static
inline
QgsSettingsTreeNamedListNode
*sTreeStoredQueries =
QgsSettingsTree::sTreeDatabase
->createNamedListNode( u
"stored-queries"
_s );
44
static
const
QgsSettingsEntryString
*settingQueryName;
45
static
const
QgsSettingsEntryString
*settingQueryDefinition;
47
#endif
48
53
QgsStoredQueryManager
( QObject *parent =
nullptr
);
54
67
void
storeQuery
(
const
QString &name,
const
QString &
query
,
Qgis::QueryStorageBackend
backend =
Qgis::QueryStorageBackend::LocalProfile
);
68
77
void
removeQuery
(
const
QString &name,
Qgis::QueryStorageBackend
backend =
Qgis::QueryStorageBackend::LocalProfile
);
78
82
QStringList
allQueryNames
(
Qgis::QueryStorageBackend
backend =
Qgis::QueryStorageBackend::LocalProfile
)
const
;
83
87
QString
query
(
const
QString &name,
Qgis::QueryStorageBackend
backend =
Qgis::QueryStorageBackend::LocalProfile
)
const
;
88
95
class
QueryDetails
96
{
97
public
:
101
QString
name
;
102
106
QString
definition
;
107
111
Qgis::QueryStorageBackend
backend
=
Qgis::QueryStorageBackend::LocalProfile
;
112
};
113
119
QList< QgsStoredQueryManager::QueryDetails >
allQueries
()
const
;
120
121
signals:
122
126
void
queryAdded
(
const
QString &name,
Qgis::QueryStorageBackend
backend );
127
131
void
queryChanged
(
const
QString &name,
Qgis::QueryStorageBackend
backend );
132
136
void
queryRemoved
(
const
QString &name,
Qgis::QueryStorageBackend
backend );
137
138
private
:
139
static
QString getQueryHash(
const
QString &name );
140
};
141
142
143
#endif
// QGSSTOREDQUERYMANAGER_H
Qgis::QueryStorageBackend
QueryStorageBackend
Stored query storage backends.
Definition
qgis.h:3755
Qgis::QueryStorageBackend::LocalProfile
@ LocalProfile
Local user profile.
Definition
qgis.h:3756
QgsSettingsEntryString
A string settings entry.
Definition
qgssettingsentryimpl.h:123
QgsSettingsTreeNamedListNode
A named list tree node for the settings tree to help organizing and introspecting the tree.
Definition
qgssettingstreenode.h:201
QgsSettingsTree::sTreeDatabase
static QgsSettingsTreeNode * sTreeDatabase
Definition
qgssettingstree.h:86
QgsStoredQueryManager::QueryDetails
Contains details about a stored query.
Definition
qgsstoredquerymanager.h:96
QgsStoredQueryManager::QueryDetails::name
QString name
Name of the query.
Definition
qgsstoredquerymanager.h:101
QgsStoredQueryManager::QueryDetails::definition
QString definition
Query definition.
Definition
qgsstoredquerymanager.h:106
QgsStoredQueryManager::QueryDetails::backend
Qgis::QueryStorageBackend backend
Storage backend.
Definition
qgsstoredquerymanager.h:111
QgsStoredQueryManager::allQueries
QList< QgsStoredQueryManager::QueryDetails > allQueries() const
Returns details of all queries stored in the manager.
Definition
qgsstoredquerymanager.cpp:157
QgsStoredQueryManager::allQueryNames
QStringList allQueryNames(Qgis::QueryStorageBackend backend=Qgis::QueryStorageBackend::LocalProfile) const
Returns a list of the names of all stored queries for the specified backend.
Definition
qgsstoredquerymanager.cpp:107
QgsStoredQueryManager::queryRemoved
void queryRemoved(const QString &name, Qgis::QueryStorageBackend backend)
Emitted when a query is removed from the manager.
QgsStoredQueryManager::queryChanged
void queryChanged(const QString &name, Qgis::QueryStorageBackend backend)
Emitted when an existing query is changed in the manager.
QgsStoredQueryManager::queryAdded
void queryAdded(const QString &name, Qgis::QueryStorageBackend backend)
Emitted when a query is added to the manager.
QgsStoredQueryManager::QgsStoredQueryManager
QgsStoredQueryManager(QObject *parent=nullptr)
Constructor for QgsStoredQueryManager, with the specified parent object.
Definition
qgsstoredquerymanager.cpp:33
QgsStoredQueryManager::query
QString query(const QString &name, Qgis::QueryStorageBackend backend=Qgis::QueryStorageBackend::LocalProfile) const
Returns the query definition with matching name, from the specified backend.
Definition
qgsstoredquerymanager.cpp:137
QgsStoredQueryManager::removeQuery
void removeQuery(const QString &name, Qgis::QueryStorageBackend backend=Qgis::QueryStorageBackend::LocalProfile)
Removes the stored query with matching name.
Definition
qgsstoredquerymanager.cpp:77
QgsStoredQueryManager::storeQuery
void storeQuery(const QString &name, const QString &query, Qgis::QueryStorageBackend backend=Qgis::QueryStorageBackend::LocalProfile)
Saves a query to the manager.
Definition
qgsstoredquerymanager.cpp:37
qgis.h
qgssettingstree.h
Generated on
for QGIS API Documentation by
1.17.0