diff --git a/plasmoidviewer/main.cpp b/plasmoidviewer/main.cpp --- a/plasmoidviewer/main.cpp +++ b/plasmoidviewer/main.cpp @@ -85,6 +85,8 @@ parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("t") << QStringLiteral("theme"), i18n("The name of the theme which the shell will use"), QStringLiteral("themeName"))); + parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("b") << QStringLiteral("nobuttons"), + i18n("Show the button bar"))); parser.addPositionalArgument(QStringLiteral("externalData"), i18n("Data that should be passed to the applet as 'externalData' event")); @@ -143,6 +145,10 @@ QPixmapCache::setCacheLimit(parser.value("pixmapcache").toInt()); } + if (parser.isSet("nobuttons")) { + v->setButtonsVisible(false); + } + // emit externalData event so we you can launch e.g. an icon applet already with a proper URL if (parser.positionalArguments().count() == 1) { v->emitExternalData(parser.positionalArguments().constFirst()); diff --git a/plasmoidviewer/qmlpackages/shell/contents/views/Desktop.qml b/plasmoidviewer/qmlpackages/shell/contents/views/Desktop.qml --- a/plasmoidviewer/qmlpackages/shell/contents/views/Desktop.qml +++ b/plasmoidviewer/qmlpackages/shell/contents/views/Desktop.qml @@ -32,6 +32,7 @@ SdkButtons { id: buttons + visible: desktop.buttonsVisible z: +1 anchors { fill: backgroundButtons @@ -54,6 +55,7 @@ Background { id: backgroundButtons + visible: buttons.visible width: buttons.backgroundWidth height: buttons.backgroundHeight anchors { diff --git a/plasmoidviewer/qmlpackages/shell/contents/views/SdkButtons.qml b/plasmoidviewer/qmlpackages/shell/contents/views/SdkButtons.qml --- a/plasmoidviewer/qmlpackages/shell/contents/views/SdkButtons.qml +++ b/plasmoidviewer/qmlpackages/shell/contents/views/SdkButtons.qml @@ -156,7 +156,7 @@ PlasmaComponents.Button { iconSource: "hide_table_row" onClicked: { - root.visible = false; + desktop.buttonsVisible = false; } } } diff --git a/plasmoidviewer/view.h b/plasmoidviewer/view.h --- a/plasmoidviewer/view.h +++ b/plasmoidviewer/view.h @@ -27,6 +27,7 @@ { Q_OBJECT Q_PROPERTY(bool konsoleVisible READ konsoleVisible CONSTANT); + Q_PROPERTY(bool buttonsVisible READ buttonsVisible WRITE setButtonsVisible NOTIFY buttonsVisibleChanged); public: View(ViewerCorona *corona, bool konsoleVisible, QWindow *parent = nullptr); @@ -39,18 +40,25 @@ void emitExternalData(const QString &data); bool konsoleVisible(); + bool buttonsVisible(); + void setButtonsVisible(bool buttonsVisible); + Q_INVOKABLE void changeFormFactor(int formFactor); Q_INVOKABLE void changeLocation(int location); Q_INVOKABLE void takeScreenShot(); static ViewerCorona *createCorona(); +Q_SIGNALS: + void buttonsVisibleChanged(); + protected: QString pluginFromPath(const QString &path) const; private: QString m_lastAppletName; bool m_konsoleVisible; + bool m_buttonsVisible = true; }; #endif // VIEW_H diff --git a/plasmoidviewer/view.cpp b/plasmoidviewer/view.cpp --- a/plasmoidviewer/view.cpp +++ b/plasmoidviewer/view.cpp @@ -254,6 +254,19 @@ return m_konsoleVisible; } +bool View::buttonsVisible() +{ + return m_buttonsVisible; +} + +void View::setButtonsVisible(bool buttonsVisible) +{ + if (m_buttonsVisible != buttonsVisible) { + m_buttonsVisible = buttonsVisible; + emit buttonsVisibleChanged(); + } +} + void View::changeLocation(int location) { QString locationType = "floating";