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. Using QTquick 1 to trigger a bash script on button click

Using QTquick 1 to trigger a bash script on button click

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qtquick1.1processqprocessqt4
5 Posts 3 Posters 817 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.
  • J Offline
    J Offline
    jcthomas556
    wrote on last edited by jcthomas556
    #1

    Hello, I'm trying to get my lightdmkde set up to trigger a bash script on clicking shutdown. I'm trying to edit the main.qml file that manages the shutdown buttons, but am having a difficult time calling the QProcess. It seems to break the display anytime I add anything QProcess related.

    It is my understanding that at the header it will need to import process in some way, though I've seen some back and forth on this. Also that it will need something like this

    QProcess process;
    process.start("dir \"\"\"My Documents\"\"\"");
    

    https://doc.qt.io/archives/qt-4.8/qprocess.html#startDetached

    I tried to add that QProcess line with and w/o any imports, both break my display. I've also tried adding an import header by itself, but that also broke my display so I must have something wrong with it.

    This is what I'd like:

    PlasmaWidgets.IconWidget {
                    text: i18n("Shutdown")
                    icon: QIcon("system-shutdown")
                    enabled: power.canShutdown;
                    onClicked: callMyOwnShutdownScript();
                } 
    

    Any tips would be appreciated, this is my first time working with anything QT related

    raven-worxR JonBJ 2 Replies Last reply
    0
    • J jcthomas556

      Hello, I'm trying to get my lightdmkde set up to trigger a bash script on clicking shutdown. I'm trying to edit the main.qml file that manages the shutdown buttons, but am having a difficult time calling the QProcess. It seems to break the display anytime I add anything QProcess related.

      It is my understanding that at the header it will need to import process in some way, though I've seen some back and forth on this. Also that it will need something like this

      QProcess process;
      process.start("dir \"\"\"My Documents\"\"\"");
      

      https://doc.qt.io/archives/qt-4.8/qprocess.html#startDetached

      I tried to add that QProcess line with and w/o any imports, both break my display. I've also tried adding an import header by itself, but that also broke my display so I must have something wrong with it.

      This is what I'd like:

      PlasmaWidgets.IconWidget {
                      text: i18n("Shutdown")
                      icon: QIcon("system-shutdown")
                      enabled: power.canShutdown;
                      onClicked: callMyOwnShutdownScript();
                  } 
      

      Any tips would be appreciated, this is my first time working with anything QT related

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @jcthomas556 said in Using QTquick 1 to trigger a bash script on button click:

      It seems to break the display anytime I add anything QProcess related.

      what does "breaking the display" mean exactly?!

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      J 1 Reply Last reply
      0
      • J jcthomas556

        Hello, I'm trying to get my lightdmkde set up to trigger a bash script on clicking shutdown. I'm trying to edit the main.qml file that manages the shutdown buttons, but am having a difficult time calling the QProcess. It seems to break the display anytime I add anything QProcess related.

        It is my understanding that at the header it will need to import process in some way, though I've seen some back and forth on this. Also that it will need something like this

        QProcess process;
        process.start("dir \"\"\"My Documents\"\"\"");
        

        https://doc.qt.io/archives/qt-4.8/qprocess.html#startDetached

        I tried to add that QProcess line with and w/o any imports, both break my display. I've also tried adding an import header by itself, but that also broke my display so I must have something wrong with it.

        This is what I'd like:

        PlasmaWidgets.IconWidget {
                        text: i18n("Shutdown")
                        icon: QIcon("system-shutdown")
                        enabled: power.canShutdown;
                        onClicked: callMyOwnShutdownScript();
                    } 
        

        Any tips would be appreciated, this is my first time working with anything QT related

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @jcthomas556
        I don't know anything about running bash under Windows. But, although this is probably not related to your error, how did you come up with this string? It resolves to dir """My Documents""". This looks both to have too many quotes and to name a path relative to your app's current directory, neither of which sound right?

        J 1 Reply Last reply
        1
        • raven-worxR raven-worx

          @jcthomas556 said in Using QTquick 1 to trigger a bash script on button click:

          It seems to break the display anytime I add anything QProcess related.

          what does "breaking the display" mean exactly?!

          J Offline
          J Offline
          jcthomas556
          wrote on last edited by
          #4

          @raven-worx Sorry, should have clarified. The login screen is what I'm looking at, and when the display "breaks" What I see is all the buttons and accounts to choose from disappear, so all that's left is the blank white page.

          1 Reply Last reply
          0
          • JonBJ JonB

            @jcthomas556
            I don't know anything about running bash under Windows. But, although this is probably not related to your error, how did you come up with this string? It resolves to dir """My Documents""". This looks both to have too many quotes and to name a path relative to your app's current directory, neither of which sound right?

            J Offline
            J Offline
            jcthomas556
            wrote on last edited by
            #5

            @JonB This is a quote from the example given on the link listed. It's from QT, in an explanation of how this works. It's not a string that I came up with, or that I'm using.

            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