QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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#include "moc_qgsprojectitem.cpp"
20#include <QDir>
21
22QgsProjectItem::QgsProjectItem( QgsDataItem *parent, const QString &name,
23 const QString &path, const QString &providerKey )
24 : QgsDataItem( Qgis::BrowserItemType::Project, parent, name, path, providerKey )
25{
26 mIconName = QStringLiteral( ":/images/icons/qgis_icon.svg" );
27 setToolTip( QDir::toNativeSeparators( path ) );
28 setState( Qgis::BrowserItemState::Populated ); // no more children
29}
30
32{
34 u.layerType = QStringLiteral( "project" );
35 u.name = mName;
36 u.uri = mPath;
37
39 {
40 u.filePath = path();
41 }
42
43 return { u };
44}
45
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
@ Populated
Children created.
@ ItemRepresentsFile
Item's path() directly represents a file on disk.
Base class for all items in the model.
Definition qgsdataitem.h:46
QString mName
void setToolTip(const QString &msg)
QString mPath
QString mIconName
QString path() const
virtual void setState(Qgis::BrowserItemState state)
Set item state.
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.