QGIS API Documentation
3.41.0-Master (3440c17df1d)
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
41
#ifndef SIP_RUN
42
48
template
<
class
T>
49
static
void
deleteConnections
(
const
QList< T * > &items,
const
std::function<
void
(
const
QString & ) > &deleteConnection,
QgsDataItemGuiContext
context )
50
{
51
( void )context;
52
if
( items.empty() )
53
return
;
54
55
QStringList connectionNames;
56
connectionNames.reserve( items.size() );
57
for
( T *item : items )
58
{
59
connectionNames << item->name();
60
}
61
QPointer< QgsDataItem > firstParent( items.at( 0 )->parent() );
62
deleteConnectionsPrivate( connectionNames, deleteConnection, firstParent );
63
}
64
73
static
const
QString uniqueName(
const
QString &name,
const
QStringList &connectionNames );
74
75
#endif
76
77
private
:
78
static
void
deleteConnectionsPrivate(
const
QStringList &connectionNames,
const
std::function<
void
(
const
QString & )> &deleteConnection, QPointer<QgsDataItem> firstParent );
79
};
80
81
#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:49
QgsDataItem
Base class for all items in the model.
Definition
qgsdataitem.h:46
qgis.h
qgis_sip.h
qgsdataitem.h
qgsdataitemguiprovider.h
Generated on Sat Nov 23 2024 09:26:05 for QGIS API Documentation by
1.9.8