QGIS API Documentation
3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
src
gui
editorwidgets
qgsqmlwidgetwrapper.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsqmlwidgetwrapper.h
3
4
---------------------
5
begin : 25.6.2018
6
copyright : (C) 2018 by Matthias Kuhn
7
email :
[email protected]
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 QGSQMLWIDGETWRAPPER_H
17
#define QGSQMLWIDGETWRAPPER_H
18
19
#include "
qgswidgetwrapper.h
"
20
#include "
qgis_sip.h
"
21
#include "qgis_gui.h"
22
23
#include <QQuickWidget>
24
30
class
GUI_EXPORT
QgsQmlWidgetWrapper
:
public
QgsWidgetWrapper
31
{
32
Q_OBJECT
33
34
public
:
35
43
QgsQmlWidgetWrapper
(
QgsVectorLayer
*layer, QWidget *editor, QWidget *parent );
44
45
bool
valid
()
const override
;
46
47
QWidget *
createWidget
( QWidget *parent )
override
;
48
49
void
initWidget
( QWidget *editor )
override
;
50
52
void
reinitWidget();
53
55
void
setQmlCode(
const
QString &qmlCode );
56
57
public
slots:
58
void
setFeature
(
const
QgsFeature
&feature )
override
;
59
60
private
slots:
62
void
setQmlContext();
63
64
private
:
65
QTemporaryFile mQmlFile;
66
QString mQmlCode;
67
QQuickWidget *mWidget =
nullptr
;
68
QgsFeature
mFeature;
69
QgsFeature
mFormFeature;
70
bool
mRequiresFormScope =
false
;
71
};
72
73
74
#ifndef SIP_RUN
76
82
class
QmlExpression :
public
QObject
83
{
84
Q_OBJECT
85
86
public
:
88
void
setExpressionContext(
const
QgsExpressionContext
&context );
89
91
Q_INVOKABLE QVariant evaluate(
const
QString &expression )
const
;
92
93
private
:
94
QgsExpressionContext
mExpressionContext;
95
};
97
#endif
//SIP_RUN
98
99
#endif
// QGSQMLWIDGETWRAPPER_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition
qgsexpressioncontext.h:471
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:58
QgsQmlWidgetWrapper
Wraps a QQuickWidget to display QML code.
Definition
qgsqmlwidgetwrapper.h:31
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition
qgsvectorlayer.h:401
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:108
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
qgis_sip.h
qgswidgetwrapper.h
Generated on Sat Nov 23 2024 09:26:05 for QGIS API Documentation by
1.9.8