TextEdit里面的文字内容可以分开设置属性吗
It was the first day of our winter holiday.All of us were very happy. Why? Because we have one months to do things we love to do.
效果如上,每一个句子的颜色属性都是不一样的
[解决办法]
我也尝试修改来,后来我放弃了。没找到方法,所以我用了另一种控件来实现,比如说ListView,我就可以对单独的一项来设置属性了。比如:
QListWidgetItem *item=new QListWidgetItem(ui->Detail_Log); item->setText(Message); item->setStatusTip(Message); item->setTextColor(Qt::red); item->setTextAlignment(1); ui->listview->addItem(item);
[解决办法]
可以的,简单的方法就使用html格式的内容
<html><font color=green>It was the first day of our winter holiday.</font><font color=blue>All of us were very happy.</font></html>