mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add rightclick open containing folder
This commit is contained in:
parent
4d1a4c8330
commit
5901ec592a
@ -1,5 +1,6 @@
|
||||
import QtQuick 2.9
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
Item {
|
||||
id: screenPlayItem
|
||||
@ -9,11 +10,12 @@ Item {
|
||||
property string customTitle: "name here"
|
||||
property url absoluteStoragePath
|
||||
property string type
|
||||
property bool hasMenuOpen: false
|
||||
onTypeChanged: {
|
||||
if (type === "widget") {
|
||||
icnType.source = "qrc:/assets/icons/icon_widgets.svg"
|
||||
} else if(type === "qmlScene"){
|
||||
icnType.source = "qrc:/assets/icons/icon_scene.svg"
|
||||
} else if (type === "qmlScene") {
|
||||
icnType.source = "qrc:/assets/icons/icon_code.svg"
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,15 +127,34 @@ Item {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onEntered: {
|
||||
if (!hasMenuOpen)
|
||||
screenPlayItem.state = "hover"
|
||||
}
|
||||
onExited: {
|
||||
if (!hasMenuOpen)
|
||||
screenPlayItem.state = "visible"
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
itemClicked(screenId, type)
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
contextMenu.popup()
|
||||
hasMenuOpen = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
id: contextMenu
|
||||
onClosed: hasMenuOpen = false
|
||||
MenuItem {
|
||||
text: qsTr("Open containing folder")
|
||||
onClicked: {
|
||||
screenPlaySettings.openFolderInExplorer(absoluteStoragePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,6 +294,17 @@ QString Settings::fixWindowsPath(QString url)
|
||||
return url.replace("/", "\\\\");
|
||||
}
|
||||
|
||||
void Settings::openFolderInExplorer(QString url)
|
||||
{
|
||||
QProcess explorer;
|
||||
explorer.setProgram("explorer.exe");
|
||||
QStringList args;
|
||||
args.append(QDir::toNativeSeparators(url));
|
||||
explorer.setArguments(args);
|
||||
explorer.startDetached();
|
||||
|
||||
}
|
||||
|
||||
void Settings::removeWallpaperAt(int pos)
|
||||
{
|
||||
if (pos > 0 && pos > m_wallpapers.size())
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
Q_INVOKABLE void setPlayAll(bool isPlaying);
|
||||
Q_INVOKABLE QUrl getPreviewImageByMonitorID(QString id);
|
||||
Q_INVOKABLE QString fixWindowsPath(QString url);
|
||||
Q_INVOKABLE void openFolderInExplorer(QString url);
|
||||
|
||||
void loadActiveProfiles();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user