QGIS API Documentation
3.32.0-Lima (311a8cb8a6)
src
gui
editorwidgets
qgshtmlwidgetwrapper.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgshtmlwidgetwrapper.h
3
4
---------------------
5
begin : 23.03.2019
6
copyright : (C) 2019 by Alessandro Pasotti
7
email : elpaso at itopen dot it
8
***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
#ifndef QGSHTMLWIDGETWRAPPER_H
17
#define QGSHTMLWIDGETWRAPPER_H
18
19
#include "
qgswidgetwrapper.h
"
20
#include "
qgswebview.h
"
21
#include "
qgis_sip.h
"
22
#include "qgis_gui.h"
23
29
class
GUI_EXPORT
QgsHtmlWidgetWrapper
:
public
QgsWidgetWrapper
30
{
31
Q_OBJECT
32
33
public
:
34
42
QgsHtmlWidgetWrapper
(
QgsVectorLayer
*layer, QWidget *editor, QWidget *parent );
43
44
bool
valid
()
const override
;
45
46
QWidget *
createWidget
( QWidget *parent )
override
;
47
48
void
initWidget
( QWidget *editor )
override
;
49
51
void
reinitWidget();
52
54
void
setHtmlCode(
const
QString &htmlCode );
55
60
bool
needsGeometry()
const
;
61
62
public
slots:
63
void
setFeature
(
const
QgsFeature
&feature )
override
;
64
65
private
slots:
67
void
setHtmlContext( );
68
#ifdef WITH_QTWEBKIT
69
void
fixHeight();
70
#endif
71
72
private
:
73
75
void
checkGeometryNeeds();
76
77
QString mHtmlCode;
78
QgsWebView
*mWidget =
nullptr
;
79
QgsFeature
mFeature;
80
bool
mNeedsGeometry =
false
;
81
QgsFeature
mFormFeature;
82
83
friend
class
TestQgsHtmlWidgetWrapper;
84
};
85
86
87
#ifndef SIP_RUN
89
95
class
HtmlExpression :
public
QObject
96
{
97
Q_OBJECT
98
99
public
:
101
void
setExpressionContext(
const
QgsExpressionContext
&context );
102
103
public
:
104
106
Q_INVOKABLE QString evaluate(
const
QString &expression )
const
;
107
108
private
:
109
QgsExpressionContext
mExpressionContext;
110
};
111
118
class
NeedsGeometryEvaluator :
public
QObject
119
{
120
Q_OBJECT
121
122
public
:
123
125
bool
needsGeometry()
const
{
return
mNeedsGeometry; }
126
128
void
setExpressionContext(
const
QgsExpressionContext
&context );
129
131
Q_INVOKABLE
void
evaluate(
const
QString &expression );
132
133
private
:
134
bool
mNeedsGeometry =
false
;
135
QgsExpressionContext
mExpressionContext;
136
};
137
138
140
#endif
//SIP_RUN
141
142
#endif
// QGSHTMLWIDGETWRAPPER_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:481
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition:
qgsfeature.h:56
QgsHtmlWidgetWrapper
Wraps a QQuickWidget to display HTML code.
Definition:
qgshtmlwidgetwrapper.h:30
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:399
QgsWebView
The QgsWebView class is a collection of stubs to mimic the API of QWebView on systems where the real ...
Definition:
qgswebview.h:66
QgsWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition:
qgswidgetwrapper.h:53
QgsWidgetWrapper::setFeature
virtual void setFeature(const QgsFeature &feature)=0
Is called when the value of the widget needs to be changed.
QgsWidgetWrapper::valid
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
QgsWidgetWrapper::initWidget
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
Definition:
qgswidgetwrapper.cpp:107
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
qgis_sip.h
qgswebview.h
qgswidgetwrapper.h
Generated on Sun Jun 25 2023 11:54:04 for QGIS API Documentation by
1.9.4