PDA

View Full Version : Change image with a virtual button



VenAle
12th August 2019, 08:55
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).

anda_skoa
12th August 2019, 15:30
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,
_

VenAle
12th August 2019, 18:04
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).

VenAle
13th August 2019, 16:55
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?

anda_skoa
17th August 2019, 08:14
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,
_