Skip to content
Permalink
Browse files

[browser] Provide mime data for directory items

Allows them to be dragged and dropped to file widgets
  • Loading branch information
nyalldawson committed Feb 8, 2019
1 parent 2857f58 commit 35ddb3b630250a5e80073a2daa84604f53874a05
Showing with 14 additions and 0 deletions.
  1. +3 −0 python/core/auto_generated/qgsdataitem.sip.in
  2. +9 −0 src/core/qgsdataitem.cpp
  3. +2 −0 src/core/qgsdataitem.h
@@ -599,6 +599,9 @@ Constructor.

virtual QWidget *paramWidget() /Factory/;

virtual bool hasDragEnabled() const;
virtual QgsMimeDataUtils::Uri mimeUri() const;


static bool hiddenPath( const QString &path );
%Docstring
@@ -1021,6 +1021,15 @@ QWidget *QgsDirectoryItem::paramWidget()
return new QgsDirectoryParamWidget( mPath );
}

QgsMimeDataUtils::Uri QgsDirectoryItem::mimeUri() const
{
QgsMimeDataUtils::Uri u;
u.layerType = QStringLiteral( "directory" );
u.name = mName;
u.uri = mDirPath;
return u;
}

QgsDirectoryParamWidget::QgsDirectoryParamWidget( const QString &path, QWidget *parent )
: QTreeWidget( parent )
{
@@ -611,6 +611,8 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
bool equal( const QgsDataItem *other ) override;
QIcon icon() override;
QWidget *paramWidget() override SIP_FACTORY;
bool hasDragEnabled() const override { return true; }
QgsMimeDataUtils::Uri mimeUri() const override;

//! Check if the given path is hidden from the browser model
static bool hiddenPath( const QString &path );

0 comments on commit 35ddb3b

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