Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] qml and qt: pressing buttons
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qml and qt: pressing buttons

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 4 Posters 4.0k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    thisisbhaskar
    wrote on last edited by
    #2

    your question is not clear and link to the image does not work...

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #3

      Use signals & slots. If you using Qt C++, it's easy to connect your signals & slots. If you using QML, i assumed you use your custom button element, so you can:

      1. In your button's mouseArea, do something when
        @onPressed: {}@
      2. Use connect to make your signal and function's connection.

      I think you'd better read how to use signals & slots with QML first :D

      Chuck

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spode
        wrote on last edited by
        #4

        try !http://www.flickr.com/photos/64362284@N04/5960480374/in/photostream()!

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thisisbhaskar
          wrote on last edited by
          #5

          I guess these buttons are Qt::Key_Send, Qt::Key_Menu, and Qt::Key_End

          Inside your qml item
          @Keys.onPressed: {
          if (event.key == Qt.Key_Send) {
          console.log("call button pressed");
          event.accepted = true;
          }
          }
          @

          1 Reply Last reply
          0
          • S Offline
            S Offline
            spode
            wrote on last edited by
            #6

            oh it is possible! can someone confirm it, please? an example in qml please?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #7

              Vijay's "Keys.onPressed" snippet is an example in QML. What more do you need?

              Software Engineer
              My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                spode
                wrote on last edited by
                #8

                right, however can someone confirm?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mlong
                  wrote on last edited by
                  #9

                  It looks reasonable to me... should be easy enough to test.

                  console.log() is your friend.

                  Software Engineer
                  My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Chuck Gao
                    wrote on last edited by
                    #10

                    [quote author="Vijay Bhaska Reddy" date="1311249782"]I guess these buttons are Qt::Key_Send, Qt::Key_Menu, and Qt::Key_End

                    Inside your qml item
                    Keys.onPressed: {
                    if (event.key == Qt.Key_Send) {
                    console.log("call button pressed");
                    event.accepted = true;
                    }
                    }
                    [/quote]

                    Also, if you want to recieve keyboard events, make sure this:
                    @
                    // Inside your element definition
                    focus: true
                    @

                    Chuck

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      spode
                      wrote on last edited by
                      #11

                      thank everybody!

                      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