I've subclassed QDialog and reimplemented the paintEvent function. I've noticed that paintEvent does not update the regions i want to redraw. My custom dialog contains a QListWidget (list) by the way.
My code goes like this,
{
// draw title bar here
if(changeColorOfUpArrow == true)
{
qDebug("black");
painter.
setBrush(QBrush(Qt
::black, Qt
::SolidPattern));
}
else
{
qDebug("red");
painter.
setBrush(QBrush(Qt
::red, Qt
::SolidPattern));
}
// draw up arrow here
}
void QCustomDialog::paintEvent(QPaintEvent * paintEvt)
{
QPainter painter(this);
// draw title bar here
if(changeColorOfUpArrow == true)
{
qDebug("black");
painter.setBrush(QBrush(Qt::black, Qt::SolidPattern));
}
else
{
qDebug("red");
painter.setBrush(QBrush(Qt::red, Qt::SolidPattern));
}
// draw up arrow here
}
To copy to clipboard, switch view to plain text mode
I have initially set the brush color to black. The if and else statements are executed correctly, I've verified this already. But the arrow drawn is always black even if control goes to the else statement. Does anybody know what I made wrong here or is this a known issue? 
Bookmarks