File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ QWidget *QgsTextEditWrapper::createWidget( QWidget *parent )
85
85
{
86
86
if ( config ( QStringLiteral ( " UseHtml" ) ).toBool () )
87
87
{
88
- return new QTextEdit ( parent );
88
+ return new QTextBrowser ( parent );
89
89
}
90
90
else
91
91
{
@@ -100,6 +100,7 @@ QWidget *QgsTextEditWrapper::createWidget( QWidget *parent )
100
100
101
101
void QgsTextEditWrapper::initWidget ( QWidget *editor )
102
102
{
103
+ mTextBrowser = qobject_cast<QTextBrowser *>( editor );
103
104
mTextEdit = qobject_cast<QTextEdit *>( editor );
104
105
mPlainTextEdit = qobject_cast<QPlainTextEdit *>( editor );
105
106
mLineEdit = qobject_cast<QLineEdit *>( editor );
@@ -223,7 +224,14 @@ void QgsTextEditWrapper::setWidgetValue( const QVariant &val )
223
224
if ( val != value () )
224
225
{
225
226
if ( config ( QStringLiteral ( " UseHtml" ) ).toBool () )
227
+ {
226
228
mTextEdit ->setHtml ( v );
229
+ if ( mTextBrowser )
230
+ {
231
+ mTextBrowser ->setTextInteractionFlags ( Qt::LinksAccessibleByMouse );
232
+ mTextBrowser ->setOpenExternalLinks ( true );
233
+ }
234
+ }
227
235
else
228
236
mTextEdit ->setPlainText ( v );
229
237
}
Original file line number Diff line number Diff line change 20
20
21
21
#include < QLineEdit>
22
22
#include < QPlainTextEdit>
23
- #include < QTextEdit >
23
+ #include < QTextBrowser >
24
24
#include " qgis_gui.h"
25
25
26
26
SIP_NO_FILE
@@ -68,6 +68,7 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
68
68
void textChanged ( const QString &text );
69
69
70
70
private:
71
+ QTextBrowser *mTextBrowser = nullptr ;
71
72
QTextEdit *mTextEdit = nullptr ;
72
73
QPlainTextEdit *mPlainTextEdit = nullptr ;
73
74
QLineEdit *mLineEdit = nullptr ;
You can’t perform that action at this time.
0 commit comments