Results 1 to 4 of 4

Thread: customize Swipe gesture for single touch

  1. #1
    Join Date
    Aug 2014
    Posts
    22
    Thanks
    5
    Qt products
    Qt5

    Default customize Swipe gesture for single touch

    Hi All,
    working with embedded Linux Qt for customizing the swipe gesture for single touch.
    I have copied the SwipeGesture_Recongnizer function in my_widget.cpp class file and modified it to operate on single touch only.

    "QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event);"

    i have copied the above function from this path:
    https://qt.gitorious.org/qt/qt/sourc...stures.cpp#L42

    i have included
    #include <QWidget>
    #include <QImage>
    #include <QtGui>
    #include <QGesture>
    #include <QLabel>
    #include <QGestureRecognizer>
    #include <QSwipeGesture> in my file.

    for compiling the error is ""
    D:\Qt_S_Projects\Qt_Flick1\imagewidget.h:45: error: 'QSwipeGestureRecognizer' has not been declared
    QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,)


    Can any one please tell how to customize the SwipeGestureRecognizer function , or files need to be included?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: customize Swipe gesture for single touch

    I wonder what operating system you are using as a developer workstation if it doesn't even come with tools to search in text files

    This class is declared in a private header:
    qtbase/src/widgets/kernel/qstandardgestures_p.h

    Cheers,
    _

  3. #3
    Join Date
    Aug 2014
    Posts
    22
    Thanks
    5
    Qt products
    Qt5

    Default Re: customize Swipe gesture for single touch

    Hi Anda_Skoa,
    Thanks for reply..
    I am using windows desktop Qt 5.2 Open-source version, mingw48_32 compiler.

    I checked the file, it is present at above mentioned path. and I included the file as below,
    “#include "C:\Qt\Qt5.2.0\5.2.0\Src\qtbase\src\widgets\kernel\qstandardgestures_p.h"”
    If I compile the program with this file included, there is one more file to be provided
    “#include "private/qgesture_p.h"” which is included in qstandardgestures_p.h file.
    What is supposed to be included in private/qgesture_p.h file?

    I am bit confused with the following Guideline mentioned in Qt documentation. Please help to understand and Implement.
    [WIKI]http://qt-project.org/doc/qt-4.8/qgesturerecognizer.html[/WIKI]
    http://doc.qt.io/qt-4.8/"To add support for new gestures, you need to derive from QGestureRecognizer to create a custom recognizer class, construct an instance of this class, and register it with the application by calling QGestureRecognizer::registerRecognizer(). "
    I have created a image widget which is enabled to receive the gestures. As per above statement, should I declare the element of “” class as a member of the custom widget?
    Any help or suggested documentation for this?

    Thanks in advance.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: customize Swipe gesture for single touch

    Which part of the instructions do you have problems with?

    - create a subclass of QGestureRecognizer
    Qt Code:
    1. class YourGestureRecognizerClass : pubic QGestureRecognizer { ... };
    To copy to clipboard, switch view to plain text mode 

    - create an instance of that class
    Qt Code:
    1. YourGestureRecognizerClass *a = new YourGestureRecognizerClass();
    To copy to clipboard, switch view to plain text mode 

    - register it
    Qt Code:
    1. QGestureRecognizer::registerRecognizer(a);
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    SSqt5.2 (9th December 2014)

Similar Threads

  1. Swipe gesture not recognized
    By Luc4 in forum Qt Programming
    Replies: 2
    Last Post: 16th December 2014, 15:13
  2. QML Swipe gesture overrides other components
    By juracist in forum Qt Quick
    Replies: 1
    Last Post: 9th November 2014, 23:03
  3. Touch screen wrong coordinates on touch
    By Talei in forum Qt Programming
    Replies: 0
    Last Post: 1st January 2014, 22:35
  4. Replies: 1
    Last Post: 25th March 2011, 11:33
  5. Replies: 0
    Last Post: 18th November 2010, 16:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.