mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[FEATURE] Add 'open directory' action to right click menu for
folders in browser dock Opens the folder in the OS' file explorer
This commit is contained in:
parent
dc72e140e9
commit
6ce3c6100d
@ -533,6 +533,9 @@ Check if the given path is hidden from the browser model
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
virtual QList<QAction *> actions();
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void childrenCreated();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QVector>
|
||||
#include <QStyle>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "qgis.h"
|
||||
#include "qgsdataitem.h"
|
||||
@ -852,6 +853,18 @@ bool QgsDirectoryItem::hiddenPath( const QString &path )
|
||||
return ( idx > -1 );
|
||||
}
|
||||
|
||||
QList<QAction *> QgsDirectoryItem::actions()
|
||||
{
|
||||
QList<QAction *> result;
|
||||
QAction *openFolder = new QAction( tr( "Open Directory…" ), this );
|
||||
connect( openFolder, &QAction::triggered, this, [ = ]
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( mDirPath ) );
|
||||
} );
|
||||
result << openFolder;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void QgsDirectoryItem::childrenCreated()
|
||||
{
|
||||
|
@ -476,6 +476,8 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
|
||||
//! Check if the given path is hidden from the browser model
|
||||
static bool hiddenPath( const QString &path );
|
||||
|
||||
QList<QAction *> actions() override;
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void childrenCreated() override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user