Skip to content

Commit 5ad1633

Browse files
committed
Ensure compatibility with QTextEdit
1 parent 3c7b74f commit 5ad1633

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/gui/editorwidgets/qgstexteditwrapper.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ QWidget *QgsTextEditWrapper::createWidget( QWidget *parent )
100100

101101
void QgsTextEditWrapper::initWidget( QWidget *editor )
102102
{
103-
mTextEdit = qobject_cast<QTextBrowser *>( editor );
103+
mTextBrowser = qobject_cast<QTextBrowser *>( editor );
104+
mTextEdit = qobject_cast<QTextEdit *>( editor );
104105
mPlainTextEdit = qobject_cast<QPlainTextEdit *>( editor );
105106
mLineEdit = qobject_cast<QLineEdit *>( editor );
106107

@@ -225,8 +226,11 @@ void QgsTextEditWrapper::setWidgetValue( const QVariant &val )
225226
if ( config( QStringLiteral( "UseHtml" ) ).toBool() )
226227
{
227228
mTextEdit->setHtml( v );
228-
mTextEdit->setTextInteractionFlags( Qt::LinksAccessibleByMouse );
229-
mTextEdit->setOpenExternalLinks( true );
229+
if ( mTextBrowser )
230+
{
231+
mTextBrowser->setTextInteractionFlags( Qt::LinksAccessibleByMouse );
232+
mTextBrowser->setOpenExternalLinks( true );
233+
}
230234
}
231235
else
232236
mTextEdit->setPlainText( v );

src/gui/editorwidgets/qgstexteditwrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
6868
void textChanged( const QString &text );
6969

7070
private:
71-
QTextBrowser *mTextEdit = nullptr;
71+
QTextBrowser *mTextBrowser = nullptr;
72+
QTextEdit *mTextEdit = nullptr;
7273
QPlainTextEdit *mPlainTextEdit = nullptr;
7374
QLineEdit *mLineEdit = nullptr;
7475
QPalette mReadOnlyPalette;

0 commit comments

Comments
 (0)