1

I have a 'QGraphicsScene' scene and am trying to use

addText(const QString &text, const QFont &font = QFont())

to add some texts to the scene. It worked. But, I tried to change the text color but could NOT find a way to set the color for 'QFont'. I did not find 'font.setColor' type method.

Any suggestion?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Steven Cao
  • 83
  • 2
  • 7
  • Thanks. It does work. However, if possible, I still would like to know: Do we have a way to set the color for a QFont type class? – Steven Cao Oct 01 '19 at 14:52

1 Answers1

0

In Qt the color is not part of QFont. Did you try addText()->setDefaultTextColor()?

natter1
  • 354
  • 2
  • 10
  • Thanks. I just tried and worked. However, if possible, I still would like to know: Do we have a way to set the color for a QFont type class? – Steven Cao Oct 01 '19 at 14:54
  • As far as I know, thats not possible. Qt library is structured in a way, where the color is not part of the Font. – natter1 Oct 01 '19 at 15:55