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. Qt Gestures and Signals.
QtWS25 Last Chance

Qt Gestures and Signals.

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 5 Posters 2.8k 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.
  • N Offline
    N Offline
    nonikhanna
    wrote on last edited by
    #1

    I was wondering how do you recognize gestures in Qt, and how to link actions to those gestures. I was thinking of making a signal that when the gesture(swipe) is made, it will trigger a slot(run a program). But I don't know how to make a signal(slot is made), and how to implement the gesture recognition in the code.

    Edit: this is for Symbian^3 OS version Belle.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chriadam
      wrote on last edited by
      #2

      Are you using QML or plain C++ to implement your application UI? If you're using C++, you could inspect touch events directly, to perform gesture recognition. If you're using QML, you can use a MouseArea element, and use mouse.x and mouse.y data inside an onPressed handler.

      As to how you recognise gestures, once you have access to the touch data, well, that's a rather more complex question.

      Good luck!

      1 Reply Last reply
      0
      • M Offline
        M Offline
        morinehtar0
        wrote on last edited by
        #3

        Did you have a look at the documentation for QGesture & friends ?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          matti-
          wrote on last edited by
          #4

          Grab the gesture type. Handle it in your QWidget::event(). Emit the proper signal. See the Gesture Programming & Signals + Slots documentation. And better do the last one first. ;)

          Author of <a href="http://mmark.777-team.org/">MMark13</a>

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nonikhanna
            wrote on last edited by
            #5

            Hey guys, to chriadam, I am using C++.
            to morinehtar0 I tried to understand it but I still am a rookie. I know Java and Actionscript. But C++ is a bit different.
            THANKS GUYS!!! just think I have Finished it!!!

            @
            void MainWindow:: initialY(){
            init=MouseLocator();
            }
            void MainWindow::finalY(){
            fin=MouseLocator();
            }
            void MainWindow::action(){
            if(fin-init<-500){
            //put function here.
            }
            }

            int MainWindow::MouseLocator()
            {
            QPoint relativeMousePos = QCursor::pos();
            int a=relativeMousePos.y();
            return a;
            }
            @
            Here is my code. initialY() runs when I press the button. finalY() runs when I release the button. also action() runs when I release my button. MouseLocator() just takes the mouse location at that instant. MY FIRST PROGRAM IN C++ And I have sort of imitated the Swipe gesture. Thanks guys!

            Edit: also the init and fin variables were global int variables. just to take in the Y value.

            Edit: please use @ tags around code snippets; Andre

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rokemoon
              wrote on last edited by
              #6

              @nonikhanna
              Please use tag @ for code snippets, thank's

              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