设置文字颜色:
void MainWindow::ShowColorBtn()
{
QColor color = QColorDialog::getColor( Qt::red, this );
if( color.isValid() )
{
QTextCharFormat fmt;
fmt.setForeground( color );
}
}
标准颜色对话框QColorDialog类的使用:
QColor getColor
(
const QColor & initial = Qt::white,
QWidget * parent = 0
);