I had a similar scenario with a row of PushButtons that I wanted to change color as the mouse was over them. They were implemented flat in QTDesigner with mouseTracking set true. Text in a QLabel also changed depending on the PushButton under the cursor.
{
int X = event->x();
int Y = event->y();
if( X > 0 && X < 160)
{
if( Y > 0 && Y < 80)
{
TWButton
->setPalette
( QColor( 255,
255,
255,
255));
textLabel->setText( twString);
}
else
TWButton
->setPalette
( QColor( 0,
170,
255,
255));
etc.
void Clone::mouseMoveEvent( QMouseEvent *event)
{
int X = event->x();
int Y = event->y();
if( X > 0 && X < 160)
{
if( Y > 0 && Y < 80)
{
TWButton->setPalette( QColor( 255,255,255,255));
textLabel->setText( twString);
}
else
TWButton->setPalette( QColor( 0,170,255,255));
etc.
To copy to clipboard, switch view to plain text mode
I'm sure you could accomplish the same thing with a group of QLabels merged together so they would look like a single object until changed by the cursor.
Bookmarks