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. QML Design, required C++ logic?

QML Design, required C++ logic?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 4 Posters 1.2k 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.
  • B Offline
    B Offline
    baer999
    wrote on last edited by
    #1

    Is it possible to make all logic in QML or do I have restrictions against C++ code?

    I want to make a alarm buzzer for my Raspberry Pi - for this I need some logic in setting up an alarm (cron job), set different MP3 files for playing and do some other stuff (sleep, etc.).

    My question that makes me crazy right now is:

    Can I do all in QML (Design and Logic) or do I have to use C++ additionally?

    If C++ is needed is there a tutorial how to bind C++ method slots to QML signals?

    Thx!

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I dont' think you'll manage to set up a cron job from within QML, but other tasks are doable there easily.

      Here is a part of the documentation for connecting C++ and QML: "link":http://qt-project.org/doc/qt-5/qtqml-cppintegration-topic.html.

      (Z(:^

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dasRicardo
        wrote on last edited by
        #3

        Hmm, another way can be to write a nice little nodejs server that listen to a specific port. With qml and JavaScript you can send request to this server with the needed data. Be careful normally for create cron jobs you need root rights it doesn't madder if c++ or nodejs or whatever.

        **Sorry for my english :)

        PLEASE ADD [SOLVED] TO YOUR THREAD TITLE IF IT'S SOLVED.**

        1 Reply Last reply
        0
        • B Offline
          B Offline
          belab
          wrote on last edited by
          #4

          You might wrap you qml app into a shell script. Pipe the input of a crontab file to your app and pipe the output back to the crontab file and call crontab, e.g.:
          @
          cat MyCrontab.txt | xargs myQmlAlaramApp > MyCrontab.txt
          crontab MyCrontab.txt
          @
          Inside qml access the argument string via:
          @
          Text {
          text: Qt.application.arguments[1]
          @

          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