Hi,
I have a serious problem in changing the existing color of an object when a particular function is called.
I have designed a GUI to control the Khepera Robot. I have designed this GUI using Qt Designer as well as coding. The object which for which I need to change the colour, I have drawn it using code. Actually I have drawn a circle with two rows of rectangles, each row with 8 rectangles along the circumfrence of the circle. These rectangles represent the sensors ( 8 Ambient sensors and 8 proximity Sensors). I have given two different colours to each row of rectangles. My aim is to change the colour of the rectangles in each row when their respective function for reading the ssensors is called. I am prsenting below my code for GUI which I have written. Fucntions to read sensors getAmbientSensors() and getProximitySensors() are implemented in KheperaiiInterface.cpp which is a robot functioning code.
Actually the problem is where I should call these two functions. I thought of writing like this in MoveRobot constructor...
connect (timer, SIGNAL(timeout()), this, SLOT(getAmbientSensors()));
timer->start(1000);
QTimer *timer = new QTimer(this);
connect (timer, SIGNAL(timeout()), this, SLOT(getAmbientSensors()));
timer->start(1000);
To copy to clipboard, switch view to plain text mode
For every 1000ms the timer updates and it calls the function getAmbientSensors() which returns the ambient sensors. Now my problem is where to write the function to change the existing color of the rectangles representing 'Ambient Sensors' of the robot. I think, I can write this function only in paintEvent() but how to write it and what is the synatax of this? Please help me in this regard. If you don't understand my question properly please reply me, I will try to explain you in a better way.
Please help me by suggesting me a good solution in this regard.
Your help would be a great relief to me as the final date to sub,mit my project is very near.
With Regards
Thirupathi Uppu
Bookmarks