I want to change the background color of a QPlainTextEdit
, how do I do this?
Modify the palette of your plain text edit. Sample program:
#include
#include
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QPlainTextEdit edit;
QPalette p = edit.palette();
p.setColor(QPalette::Active, QPalette::Base, Qt::red);
p.setColor(QPalette::Inactive, QPalette::Base, Qt::red);
edit.setPalette(p);
edit.show();
return app.exec();
}
Substitute whatever color you want, of course.