momentan steh ich auf dem Schlauch.
Folgendes Problem:
Ich habe eine Buttongroup (exclusive) mit mehreren Pushbuttons (als ToggleButtons):
Code: Alles auswählen
buttonBox->setColumnLayout( 5, QWidget::Horizontal );
buttonBox->setAlignment( Qt::AlignLeft );
buttonBox->setExclusive(TRUE);
buttonBox->setBackgroundMode( Qt::PaletteButton );
c=0;
for (QStringList::Iterator it = butList.begin(); it != butList.end(); ++it )
{
but = new QPushButton( *it, buttonBox );
but->setToggleButton( TRUE );
but->setHidden( FALSE );
buttonBox->insert( but, c );
c++;
}
connect( buttonBox, SIGNAL(pressed(int)), this, SLOT(buttonPressed(int)));
Das Signal wird in einem entsprechenden Slot empfangen. Dort
wiederrum wird eine Routine/Prozess gestartet und der Button soll gefärbt werden:
Code: Alles auswählen
void buttonPressed( int id )
{
QButton *but;
but = buttonBox->find(id);
if ( but->text() == "Bla" )
{
if ( running( but->text() == 0 )
{
QPalette p = but->palette();
p.setColor(QColorGroup::Button, color);
but->setPalette(p);
but->repaint();
}
}
}
Frage: Wie bekomme ich das hin, das der Button auch im aktiven Zustand bunt ist?
Ich benutze Qt 3.3.4 unter SuSE Linux 9.3.
Wolfgang