函数原型:void QTextFormat::setForeground(const QBrush & brush)
QColor color = QColorDialog::getColor(Qt::black,this); //使用了标准颜色对话框的方式,当单击触发颜色按钮时,弹出标准颜色对话框选择颜色
if(color.isValid())
{
QTextCharFormat format;
format.setForeground(color);
showWidget->text->mergeCurrentCharFormat(format);
}
为什么setForeground函数原型中形参类型为QBrush,而在上面例程中传入的参数类型为QColor也会编译动过啊??求大神指导问题困扰了好久了,希望大神帮忙解决一下