Results 1 to 4 of 4

Thread: Rotary encoder driver in Qt

  1. #1
    Join Date
    Jan 2013
    Posts
    44
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Rotary encoder driver in Qt

    hi all everyone
    i have register a rotary encoder in /dev/input/event1, and when i read it by evtest as belows:
    Supported events:
    Event type 0 (Sync)
    Event type 3 (Absolute)
    Event code 0 (X)
    Value 0
    Min 0
    Max 24
    Flat 1
    Testing ... (interrupt to exit)
    Event: time 1421072947.095573, type 3 (Absolute), code 0 (X), value 1
    Event: time 1421072947.095603, -------------- Report Sync ------------
    Event: time 1421072948.625644, type 3 (Absolute), code 0 (X), value 2
    Event: time 1421072948.625644, -------------- Report Sync ------------
    Event: time 1421072949.476578, type 3 (Absolute), code 0 (X), value 3
    Event: time 1421072949.476578, -------------- Report Sync ------------
    Event: time 1421072949.689086, type 3 (Absolute), code 0 (X), value 4
    Event: time 1421072949.689116, -------------- Report Sync ------------
    Event: time 1421072953.076890, type 3 (Absolute), code 0 (X), value 3
    Event: time 1421072953.076890, -------------- Report Sync ------------
    Event: time 1421072953.904663, type 3 (Absolute), code 0 (X), value 2
    Event: time 1421072953.904663, -------------- Report Sync ------------

    and I want using with an event in Qt ,how I can work well?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Rotary encoder driver in Qt

    Wrap the code that handles your encoder events in a Qt / C++ class derived from QObject. Add a custom signal ("encoderEvent" maybe) that contains the parameters you want to read from the encoder. Each time your handler receives an event from the encoder, emit the signal with the parameters you have received.

  3. #3
    Join Date
    Jan 2013
    Posts
    44
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Rotary encoder driver in Qt

    hi d_stranz's ,
    i have emit signal from a event above but it's emit to all form ,both mainform and childform( is child of main when press button on main) ,
    i only want that when open 1 active form ,it's only emit to 1 form

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Rotary encoder driver in Qt

    Signals are handled only if you connect them to a slot in your GUI. If you don't want a signal handled by a child, then don't connect it to a slot in the child.

    Since you haven't posted any code, it is impossible to tell what you might have done wrong.

Similar Threads

  1. Replies: 0
    Last Post: 3rd November 2014, 17:07
  2. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 16:00
  3. source code for odbc driver or MySql driver in arm-embedded-linux
    By sattu in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th January 2011, 11:11
  4. How to read Rotary encoder pulses?
    By gazel in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 29th August 2010, 19:41
  5. Custom gfx driver(subdriver) with Transformed gfx driver - is this possible?
    By slscripters in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 24th June 2010, 11:25

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.