0

I have a QString, for example "https://google.com", I should convert from QString to QUrl and then add that QUrl in QTextEdit, when i click that URL, it will open https://google.com.

The next question is, is it possible to make an IMAGE-URL? For example: if “https://example.com” opens a clothing site, can I add an IMAGE-URL to QTextEdit so when I click on this image it will open https://example.com, where IMAGE is image of clothes that opens https://example.com

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97

1 Answers1

0

Use QLabel: https://doc.qt.io/qt-5/qlabel.html

Example:

label->setText("<a href=\"http://example.com/\">Click Here!</a>");
label->setTextFormat(Qt::RichText);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
label->setOpenExternalLinks(true);
bogdyname
  • 358
  • 2
  • 10