I was looking for options like QGraphicsTextItem::setPen()
, or even QFont::setColor()
or QFont::setForegroundColor()
. None of them exi
Are you looking for a combination of setPlainText()
and setDefaultTextColor()
?
http://doc.qt.io/archives/qt-4.7/qgraphicstextitem.html#setPlainText
http://doc.qt.io/archives/qt-4.7/qgraphicstextitem.html#setDefaultTextColor
If not, I'm not sure I understand your question...
scene.addText(tr("Hello World"))->setDefaultTextColor(Qt::white);
QGraphicsTextItem has a palette
method which returns a QPalette
and QPalette
has the setColor method which takes a role.
void QPalette::setColor ( ColorRole role, const QColor & color )
The role you want is
QPalette::Text The foreground color used with Base.
This is usually the same as the WindowText, in which case it must provide
good contrast with Window and Base.