This commit is contained in:
Nyall Dawson 2019-02-08 19:23:40 +10:00
parent 35ddb3b630
commit 48e05434e4
4 changed files with 49 additions and 6 deletions

View File

@ -533,8 +533,19 @@ A Collection: logical collection of layers or subcollections, e.g. GRASS locatio
void addChild( QgsDataItem *item /Transfer/ ); void addChild( QgsDataItem *item /Transfer/ );
static QIcon iconDir(); // shared icon: open/closed directory static QIcon iconDir();
static QIcon iconDataCollection(); // default icon for data collection %Docstring
Returns the standard browser directory icon.
.. seealso:: :py:func:`iconDataCollection`
%End
static QIcon iconDataCollection();
%Docstring
Returns the standard browser data collection icon.
.. seealso:: :py:func:`iconDir`
%End
protected: protected:
@ -593,6 +604,10 @@ Constructor.
QString dirPath() const; QString dirPath() const;
%Docstring
Returns the full path to the directory the item represents.
%End
virtual bool equal( const QgsDataItem *other ); virtual bool equal( const QgsDataItem *other );
virtual QIcon icon(); virtual QIcon icon();

View File

@ -67,6 +67,7 @@ Gets mesh layer from uri if possible, otherwise returns None and error is set
QString layerType; QString layerType;
QString providerKey; QString providerKey;
QString name; QString name;
QString uri; QString uri;
QStringList supportedCrs; QStringList supportedCrs;

View File

@ -556,8 +556,17 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem
void addChild( QgsDataItem *item SIP_TRANSFER ) { mChildren.append( item ); } void addChild( QgsDataItem *item SIP_TRANSFER ) { mChildren.append( item ); }
static QIcon iconDir(); // shared icon: open/closed directory /**
static QIcon iconDataCollection(); // default icon for data collection * Returns the standard browser directory icon.
* \see iconDataCollection()
*/
static QIcon iconDir();
/**
* Returns the standard browser data collection icon.
* \see iconDir()
*/
static QIcon iconDataCollection();
protected: protected:
@ -607,7 +616,11 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
QVector<QgsDataItem *> createChildren() override; QVector<QgsDataItem *> createChildren() override;
/**
* Returns the full path to the directory the item represents.
*/
QString dirPath() const { return mDirPath; } QString dirPath() const { return mDirPath; }
bool equal( const QgsDataItem *other ) override; bool equal( const QgsDataItem *other ) override;
QIcon icon() override; QIcon icon() override;
QWidget *paramWidget() override SIP_FACTORY; QWidget *paramWidget() override SIP_FACTORY;

View File

@ -72,16 +72,30 @@ class CORE_EXPORT QgsMimeDataUtils
*/ */
QgsMeshLayer *meshLayer( bool &owner, QString &error ) const; QgsMeshLayer *meshLayer( bool &owner, QString &error ) const;
//! Type of URI. Recognized types: "vector" / "raster" / "mesh" / "plugin" / "custom" / "project" /**
* Type of URI.
*
* Recognized types include
* - "vector": vector layers
* - "raster": raster layers
* - "mesh": mesh layers
* - "plugin": plugin layers
* - "custom": custom types
* - "project": QGS/QGZ project file
* - "directory": directory path
*
* Mime data from plugins may use additional custom layer types.
*/
QString layerType; QString layerType;
/** /**
* For "vector" / "raster" type: provider id. * For "vector" / "raster" type: provider id.
* For "plugin" type: plugin layer type name. * For "plugin" type: plugin layer type name.
* For "custom" type: key of its QgsCustomDropHandler * For "custom" type: key of its QgsCustomDropHandler
* For "project" type: unused * For "project" and "directory" types: unused
*/ */
QString providerKey; QString providerKey;
//! Human readable name to be used e.g. in layer tree //! Human readable name to be used e.g. in layer tree
QString name; QString name;
//! Identifier of the data source recognized by its providerKey //! Identifier of the data source recognized by its providerKey