PDA

View Full Version : QLineEdit not respecting setBackgroundRole?



kevbru
8th November 2010, 23:01
Hello,

I'm trying to get a sequence of QLineEdit object to alternate background colors, but the QLineEdit seems to not respect the setBackgroundRole, and instead always use QPalette::Base. Am I missing something?

Thanks,
Kevin

dgulotta
10th November 2010, 07:26
I don't think setBackgroundRole does anything any more. But you can set the background color using style sheets. For example,


lineEdit->setStyleSheet("background-color:palette(window)");

uses QPalette::WindowRole for the background.