QGIS API Documentation
3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
src
gui
qgsdataitemguiproviderutils.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdataitemguiproviderutils.h
3
--------------------------------------
4
Date : June 2024
5
Copyright : (C) 2024 by 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 QGSDATAITEMGUIPROVIDERUTILS_H
17
#define QGSDATAITEMGUIPROVIDERUTILS_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
#include "
qgis.h
"
22
#include "
qgsdataitem.h
"
23
#include "
qgsdataitemguiprovider.h
"
24
#include <QPointer>
25
#include <functional>
26
27
class
QgsDataItem
;
28
37
class
GUI_EXPORT
QgsDataItemGuiProviderUtils
38
{
39
public
:
40
#ifndef SIP_RUN
41
47
template
<
class
T>
48
static
void
deleteConnections
(
const
QList<T *> &items,
const
std::function<
void
(
const
QString & )> &deleteConnection,
QgsDataItemGuiContext
context )
49
{
50
( void ) context;
51
if
( items.empty() )
52
return
;
53
54
QStringList connectionNames;
55
connectionNames.reserve( items.size() );
56
for
( T *item : items )
57
{
58
connectionNames << item->name();
59
}
60
QPointer<QgsDataItem> firstParent( items.at( 0 )->parent() );
61
deleteConnectionsPrivate( connectionNames, deleteConnection, firstParent );
62
}
63
72
static
const
QString uniqueName(
const
QString &name,
const
QStringList &connectionNames );
73
74
#endif
75
76
private
:
77
static
void
deleteConnectionsPrivate(
const
QStringList &connectionNames,
const
std::function<
void
(
const
QString & )> &deleteConnection, QPointer<QgsDataItem> firstParent );
78
};
79
80
#endif
// QGSDATAITEMGUIPROVIDERUTILS_H
QgsDataItemGuiContext
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
Definition
qgsdataitemguiprovider.h:42
QgsDataItemGuiProviderUtils
Utility functions for QgsDataItemGuiProviders.
Definition
qgsdataitemguiproviderutils.h:38
QgsDataItemGuiProviderUtils::deleteConnections
static void deleteConnections(const QList< T * > &items, const std::function< void(const QString &)> &deleteConnection, QgsDataItemGuiContext context)
Handles deletion of a list of connection items.
Definition
qgsdataitemguiproviderutils.h:48
QgsDataItem
Base class for all items in the model.
Definition
qgsdataitem.h:46
qgis.h
qgis_sip.h
qgsdataitem.h
qgsdataitemguiprovider.h
Generated on Sun Dec 15 2024 01:32:01 for QGIS API Documentation by
1.9.8