[Qt-interest] Updating the QPlainTextEdit's background color

Anton Chernov mechernov at gmail.com
Tue Jul 26 22:03:32 CEST 2011


Maybe set an qss on the element?

Something like

setStyleSheet( "QLineEdit { background-color: black; }" );
setAutoFillBackgroud( true );

2011/7/26 NoRulez <norulez at me.com>:
> Hi,
>
>
>
> I’m trying to set the background color of a QPlainTextEdit as followed:
>
>
>
> QPalette pal = palette();
>
> pal.setColor(QPalette::Base, Qt::yellow);
>
> setPalette(pal);
>
>
>
> But the background color doesn't change.
>
>
>
> I also tried each of the following functions after “setPalette(pal);”, but
> the result is the same (which means that the background color isn't changed)
>
> .) update();
>
> .) repaint();
>
> .) viewport()->update();
>
>
>
> So, which method can I call to change the background color immediately.
>
>
>
> Thanks in advance
>
>
>
> Best Regards
>
> NoRulez
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>



More information about the Qt-interest-old mailing list