The QString returned by QColor::name() is not a valid style sheet. You want something like:
edit
->setStyleSheet
(QString("QTextEdit { color: %1; }").
arg(color.
name()));
edit->setStyleSheet(QString("QTextEdit { color: %1; }").arg(color.name()));
To copy to clipboard, switch view to plain text mode
or you can use the QColor directly on the widget's palette.
edit->setPalette(pal);
QPalette pal = edit->palette();
pal.setBrush(QPalette::Text, color);
edit->setPalette(pal);
To copy to clipboard, switch view to plain text mode
Bookmarks