Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Left-click on plasmoid in system tray fails to execute command
QtWS25 Last Chance

Left-click on plasmoid in system tray fails to execute command

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 287 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lrnn
    wrote on last edited by
    #1

    Hello and thanks for the help.
    If this forum is not for beginners, please point me to a beginners forum. (I'm learning plasmoids and QML.)

    I'm trying to create a plasmoid that executes a command when the user left-clicks on its system tray icon.
    Unfortunately, I get an error message when I left-click on the plasmoids system tray icon.

    "main.qml":

    import QtQuick 2.5
    import QtQuick.Extras 1.4
    import org.kde.plasma.plasmoid 2.0
    import org.kde.plasma.core 2.0 as PlasmaCore
    
    Item {
        id: root
    
        // If the plasmoid in the system tray is left-clicked, then execute a system command.
        Plasmoid.icon: plasmoid.configuration.icon
        Plasmoid.icon.onClicked: { systemCommand.exec('konsole --noclose -e "echo \"Hello world\""') }
    
        // Execute a system command.
        PlasmaCore.DataSource {
            id: systemCommand
            engine: "executable"
            connectedSources: []
                    onNewData: {
                        exited(sourceName)
                        disconnectSource(sourceName) // cmd finished
                    }
            function exec(cmd) { connectSource(cmd) }
            signal exited(string sourceName)
        }
    }
    

    Error message:

    Error loading QML file: file:///home/test/.local/share/plasma/plasmoids/test/contents/ui/main.qml:11:19: Cannot assign a value directly to a grouped property
    

    I've misconfigured "Plasmoid.icon.onClicked", but I don't understand what I've done wrong (still learning object programming).
    I'd appreciate any pointers on what I've done wrong.
    Thanks for the help.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved