17

Is there a way to make links clickable in a QTextEdit?

I know I can use a QTextBrowser and connect to anchorClicked but I'd rather keep the editing and viewing all in one widget, and have clickable links when I set the widget to read-only mode.

Is this possible or am I stuck with having two separate widgets in a stack and switching between them?

feedc0de
  • 3,646
  • 8
  • 30
  • 55
dF.
  • 74,139
  • 30
  • 130
  • 136

1 Answers1

19

Since QTextBrowser inherits from QTextEdit, you should use it and set the readOnly property to false. Then you can change the style of the QTextBrowser as you want.

pestophagous
  • 4,069
  • 3
  • 33
  • 42
Patrice Bernassola
  • 14,136
  • 6
  • 46
  • 59