我想改变QPlainTextEdit
的背景颜色,我该怎么做?
最佳答案
修改纯文本编辑的调色板。示例程序:
#include <QApplication>
#include <QPlainTextEdit>
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();
}
当然可以替换任何你想要的颜色。
关于c++ - Qt QPlainTextEdit背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1528685/