Skip to content

Commit

Permalink
Ensure compatibility with QTextEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Apr 5, 2018
1 parent 3c7b74f commit 5ad1633
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/gui/editorwidgets/qgstexteditwrapper.cpp
Expand Up @@ -100,7 +100,8 @@ QWidget *QgsTextEditWrapper::createWidget( QWidget *parent )

void QgsTextEditWrapper::initWidget( QWidget *editor )
{
mTextEdit = qobject_cast<QTextBrowser *>( editor );
mTextBrowser = qobject_cast<QTextBrowser *>( editor );
mTextEdit = qobject_cast<QTextEdit *>( editor );
mPlainTextEdit = qobject_cast<QPlainTextEdit *>( editor );
mLineEdit = qobject_cast<QLineEdit *>( editor );

Expand Down Expand Up @@ -225,8 +226,11 @@ void QgsTextEditWrapper::setWidgetValue( const QVariant &val )
if ( config( QStringLiteral( "UseHtml" ) ).toBool() )
{
mTextEdit->setHtml( v );
mTextEdit->setTextInteractionFlags( Qt::LinksAccessibleByMouse );
mTextEdit->setOpenExternalLinks( true );
if ( mTextBrowser )
{
mTextBrowser->setTextInteractionFlags( Qt::LinksAccessibleByMouse );
mTextBrowser->setOpenExternalLinks( true );
}
}
else
mTextEdit->setPlainText( v );
Expand Down
3 changes: 2 additions & 1 deletion src/gui/editorwidgets/qgstexteditwrapper.h
Expand Up @@ -68,7 +68,8 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
void textChanged( const QString &text );

private:
QTextBrowser *mTextEdit = nullptr;
QTextBrowser *mTextBrowser = nullptr;
QTextEdit *mTextEdit = nullptr;
QPlainTextEdit *mPlainTextEdit = nullptr;
QLineEdit *mLineEdit = nullptr;
QPalette mReadOnlyPalette;
Expand Down

0 comments on commit 5ad1633

Please sign in to comment.