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