mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -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
|
:rtype: bool
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
virtual QList<QAction *> actions();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void childrenCreated();
|
virtual void childrenCreated();
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#include "qgis.h"
|
#include "qgis.h"
|
||||||
#include "qgsdataitem.h"
|
#include "qgsdataitem.h"
|
||||||
@ -852,6 +853,18 @@ bool QgsDirectoryItem::hiddenPath( const QString &path )
|
|||||||
return ( idx > -1 );
|
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()
|
void QgsDirectoryItem::childrenCreated()
|
||||||
{
|
{
|
||||||
|
@ -476,6 +476,8 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
|
|||||||
//! Check if the given path is hidden from the browser model
|
//! Check if the given path is hidden from the browser model
|
||||||
static bool hiddenPath( const QString &path );
|
static bool hiddenPath( const QString &path );
|
||||||
|
|
||||||
|
QList<QAction *> actions() override;
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void childrenCreated() override;
|
virtual void childrenCreated() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user