Qt/C++ - Set background of disabled button? -
i have buttons disabled in grid, some, i'd change background color. i'm trying:
_fieldbuttons[0][0]->setstylesheet("color: blue; background-color: blue;"); where
qvector<qvector<qpushbutton*> > _fieldbuttons; however, these buttons disabled, , text color gets changed:
how can change background, not text? thank you!
update figured it's not working because buttons flat. how can change flat button colors?
two options:
add
border: none;stylesheet.use
setautofillbackground(true)in conjunctionqpalette::buttonmybutton->setflat(true); mybutton->setautofillbackground(true); qpalette pal = mybutton->palette(); pal.setcolor(qpalette::button, qcolor(qt::blue)); mybutton->setpalette(pal);

Comments
Post a Comment