QStyleOptionButton Farbe für QStyle::State_MouseOver ändern
Verfasst: 13. August 2009 08:08
Hallo,
die Überschrift sagt ja schon alles. Wo kann ich die Farbe ändern? In der Palette von QApplication? Da finde ich aber nichts für diese Role.
Danke
die Überschrift sagt ja schon alles. Wo kann ich die Farbe ändern? In der Palette von QApplication? Da finde ich aber nichts für diese Role.
Danke
Code: Alles auswählen
void ItemDelegate::drawButton(QPainter *painter,
const QStyleOptionViewItem& option,
int y, int w, int h,
const QString& value) const
{
const int btnW = 90;
const int btnH = 30;
int btnX = w - btnW - 10;
int btnY = (h - btnH)/2;
QStyle *style = QApplication::style();
QStyleOptionButton opt;
opt.text = value;
opt.rect = QRect(btnX, btnY, btnW, btnH);
opt.state = QStyle::State_Enabled | QStyle::State_Selected | QStyle::State_MouseOver;
style->drawControl(QStyle::CE_PushButton, &opt, painter);
}