0

Is there a way of inserting an image in a QString? I need to have a QString this way " 'image' some text"

It needs to be a QString since i'm inserting it in a QPaint event and i cant use a QLabel for that (because i can't insert a qlabel into the painting area)

Thanks for all the help!

acerqueiro
  • 29
  • 5

1 Answers1

1

QString only contain and display text. If you want do do such a thing, you can write rich text in your QString (with HTML syntax) and display it in a component with is able to display rich text (here QGraphicsTextItem because you seem to work in a scene) :

QString myRichText = "<img src=\"URL or URI of the image\"/> some text";
QGraphicsTextItem textDisplayer(myRichText);
// Hack, hack, hack in your scene
air-dex
  • 4,130
  • 2
  • 25
  • 25