Results 1 to 5 of 5

Thread: Change image with a virtual button

  1. #1
    Join Date
    Aug 2019
    Posts
    3
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Question Change image with a virtual button

    Hi all,
    I wrote a code that receive a data from serial port and the plots it on a graph.
    Now i would like create a "virtual button", with this data, that can change image (i'm talking about three or four coloured squares).
    I' ve never imported image on Qt and i don't have any idea of how could i do, any suggestion?
    (this 'data' arrived from a range sensor that meausure the distance of my hand, so i want to create a simple gesture in 1D to control it).

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

    Default Re: Change image with a virtual button

    It is not exactly clear what kind of information you are looking for.

    If you are looking for image loading, have a look at the QImage class.

    Cheers,
    _

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

    VenAle (12th August 2019)

  4. #3
    Join Date
    Aug 2019
    Posts
    3
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Change image with a virtual button

    Quote Originally Posted by anda_skoa View Post
    It is not exactly clear what kind of information you are looking for.

    If you are looking for image loading, have a look at the QImage class.

    Cheers,
    _
    Hi anda.
    I'm sorry, maybe i didn't wrote good what kind of information i need: I would like create a code that translates a buffer of values (the measurement of distance by sensor) to a 1D gesture. but i'don't know how to do it, any suggestion?
    I thought to use it to create a program that switch between three or four images with only one 'tap' (the 'tap' is, for example, a decreasing value from my range sensor because i'm bringing my hand closer to the sensor).

  5. #4
    Join Date
    Aug 2019
    Posts
    3
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Change image with a virtual button

    I wrote a program that creates a 'led' that change color if i clicked in a button.
    I still have the problem of the buffer of values, any ideas about it?

  6. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Change image with a virtual button

    Hmm, so you want to use the sensor data to trigger an event similar to clicking a button?

    You will probably need a class that receives the sensor data and then "decides what it sees".

    If it detects your "tap" then it emits a signal.
    Alternatively it could create an event and send that into the Qt event loop, e.g. QKeyEvent simulating a key press.

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 10th February 2018, 10:40
  2. change border.width in button
    By stevocz in forum Qt Quick
    Replies: 0
    Last Post: 12th July 2013, 12:53
  3. Replies: 1
    Last Post: 5th September 2012, 07:16
  4. Replies: 3
    Last Post: 3rd August 2012, 10:35
  5. Replies: 6
    Last Post: 21st August 2010, 21:09

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.