mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-28 00:04:04 -04:00
Allow clicking hyperlinks in HTML text edit widget
This commit is contained in:
parent
7e6f423e42
commit
3c7b74fae0
@ -85,7 +85,7 @@ QWidget *QgsTextEditWrapper::createWidget( QWidget *parent )
|
||||
{
|
||||
if ( config( QStringLiteral( "UseHtml" ) ).toBool() )
|
||||
{
|
||||
return new QTextEdit( parent );
|
||||
return new QTextBrowser( parent );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -100,7 +100,7 @@ QWidget *QgsTextEditWrapper::createWidget( QWidget *parent )
|
||||
|
||||
void QgsTextEditWrapper::initWidget( QWidget *editor )
|
||||
{
|
||||
mTextEdit = qobject_cast<QTextEdit *>( editor );
|
||||
mTextEdit = qobject_cast<QTextBrowser *>( editor );
|
||||
mPlainTextEdit = qobject_cast<QPlainTextEdit *>( editor );
|
||||
mLineEdit = qobject_cast<QLineEdit *>( editor );
|
||||
|
||||
@ -223,7 +223,11 @@ void QgsTextEditWrapper::setWidgetValue( const QVariant &val )
|
||||
if ( val != value() )
|
||||
{
|
||||
if ( config( QStringLiteral( "UseHtml" ) ).toBool() )
|
||||
{
|
||||
mTextEdit->setHtml( v );
|
||||
mTextEdit->setTextInteractionFlags( Qt::LinksAccessibleByMouse );
|
||||
mTextEdit->setOpenExternalLinks( true );
|
||||
}
|
||||
else
|
||||
mTextEdit->setPlainText( v );
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QTextEdit>
|
||||
#include <QTextBrowser>
|
||||
#include "qgis_gui.h"
|
||||
|
||||
SIP_NO_FILE
|
||||
@ -68,7 +68,7 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
|
||||
void textChanged( const QString &text );
|
||||
|
||||
private:
|
||||
QTextEdit *mTextEdit = nullptr;
|
||||
QTextBrowser *mTextEdit = nullptr;
|
||||
QPlainTextEdit *mPlainTextEdit = nullptr;
|
||||
QLineEdit *mLineEdit = nullptr;
|
||||
QPalette mReadOnlyPalette;
|
||||
|
Loading…
x
Reference in New Issue
Block a user