Skip to content
Permalink
Browse files

Notify model of changes when renaming data items

  • Loading branch information
nyalldawson committed Dec 14, 2017
1 parent 8df6711 commit 12e44b2016cdf53002b829e8e1f1ffb16b94b1db
Showing with 31 additions and 1 deletion.
  1. +11 −0 python/core/qgsdataitem.sip
  2. +6 −0 src/core/qgsdataitem.cpp
  3. +14 −1 src/core/qgsdataitem.h
@@ -255,11 +255,22 @@ Create new data item.
%Docstring
:rtype: QIcon
%End

QString name() const;
%Docstring
Returns the name of the item (the displayed text for the item).

.. seealso:: :py:func:`setName()`
:rtype: str
%End

void setName( const QString &name );
%Docstring
Sets the ``name`` of the item (the displayed text for the item).

.. seealso:: :py:func:`name()`
%End

QString path() const;
%Docstring
:rtype: str
@@ -229,6 +229,12 @@ QIcon QgsDataItem::icon()
return mIconMap.value( mIconName );
}

void QgsDataItem::setName( const QString &name )
{
mName = name;
emit dataChanged( this );
}

QVector<QgsDataItem *> QgsDataItem::createChildren()
{
return QVector<QgsDataItem *>();
@@ -248,8 +248,21 @@ class CORE_EXPORT QgsDataItem : public QObject
void setParent( QgsDataItem *parent );
QVector<QgsDataItem *> children() const { return mChildren; }
virtual QIcon icon();

/**
* Returns the name of the item (the displayed text for the item).
*
* \see setName()
*/
QString name() const { return mName; }
void setName( const QString &name ) { mName = name; }

/**
* Sets the \a name of the item (the displayed text for the item).
*
* \see name()
*/
void setName( const QString &name );

QString path() const { return mPath; }
void setPath( const QString &path ) { mPath = path; }
//! Create path component replacing path separators

0 comments on commit 12e44b2

Please sign in to comment.
You can’t perform that action at this time.