QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 <QDir>
20 
21 QgsProjectItem::QgsProjectItem( QgsDataItem *parent, const QString &name,
22  const QString &path, const QString &providerKey )
23  : QgsDataItem( Qgis::BrowserItemType::Project, parent, name, path, providerKey )
24 {
25  mIconName = QStringLiteral( ":/images/icons/qgis_icon.svg" );
26  setToolTip( QDir::toNativeSeparators( path ) );
27  setState( Qgis::BrowserItemState::Populated ); // no more children
28 }
29 
31 {
33  u.layerType = QStringLiteral( "project" );
34  u.name = mName;
35  u.uri = mPath;
36  return { u };
37 }
38 
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:62
@ Populated
Children created.
Base class for all items in the model.
Definition: qgsdataitem.h:46
QString mName
Definition: qgsdataitem.h:441
void setToolTip(const QString &msg)
Definition: qgsdataitem.h:398
QString mPath
Definition: qgsdataitem.h:447
QString mIconName
Definition: qgsdataitem.h:449
QString path() const
Definition: qgsdataitem.h:346
virtual void setState(Qgis::BrowserItemState state)
Set item state.
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 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.