QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsprojectitem.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsprojectitem.cpp
3 -------------------
4 begin : 2011-04-01
5 copyright : (C) 2011 Radim Blazek
6 email : radim dot blazek at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgsprojectitem.h"
19
20#include <QDir>
21
22#include "moc_qgsprojectitem.cpp"
23
25 const QString &path, const QString &providerKey )
26 : QgsDataItem( Qgis::BrowserItemType::Project, parent, name, path, providerKey )
27{
28 mIconName = QStringLiteral( ":/images/icons/qgis_icon.svg" );
29 setToolTip( QDir::toNativeSeparators( path ) );
30 setState( Qgis::BrowserItemState::Populated ); // no more children
31}
32
34{
36 u.layerType = QStringLiteral( "project" );
37 u.name = mName;
38 u.uri = mPath;
39
41 {
42 u.filePath = path();
43 }
44
45 return { u };
46}
47
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
@ Populated
Children created.
Definition qgis.h:941
@ ItemRepresentsFile
Item's path() directly represents a file on disk.
Definition qgis.h:959
QString mName
void setToolTip(const QString &msg)
QString mPath
QgsDataItem(Qgis::BrowserItemType type, QgsDataItem *parent, const QString &name, const QString &path, const QString &providerKey=QString())
Constructor for QgsDataItem, with the specified parent item.
QString mIconName
QString name() const
Returns the name of the item (the displayed text for the item).
QString path() const
virtual void setState(Qgis::BrowserItemState state)
Set item state.
QgsDataItem * parent() const
Gets item parent.
QString providerKey() const
Returns the provider key that created this item (e.g.
virtual Qgis::BrowserItemCapabilities capabilities2() const
Returns the capabilities for the data item.
QList< QgsMimeDataUtils::Uri > UriList
QgsMimeDataUtils::UriList mimeUris() const override
Returns mime URIs for the data item, most data providers will only return a single URI but some data ...
QgsProjectItem(QgsDataItem *parent, const QString &name, const QString &path, const QString &providerKey=QString())
A data item holding a reference to a QGIS project file.
QString filePath
Path to file, if uri is associated with a file.
QString uri
Identifier of the data source recognized by its providerKey.
QString name
Human readable name to be used e.g. in layer tree.
QString layerType
Type of URI.