QGIS API Documentation
3.14.0-Pi (9f7028fd23)
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
#include <QtQuickWidgets/QQuickWidget>
23
29
class
GUI_EXPORT
QgsQmlWidgetWrapper
:
public
QgsWidgetWrapper
30
{
31
Q_OBJECT
32
33
public
:
34
42
QgsQmlWidgetWrapper
(
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
setQmlCode(
const
QString &qmlCode );
55
56
public
slots:
57
void
setFeature
(
const
QgsFeature
&feature )
override
;
58
59
private
slots:
61
void
setQmlContext();
62
63
private
:
64
QTemporaryFile mQmlFile;
65
QQuickWidget *mWidget =
nullptr
;
66
QgsFeature
mFeature;
67
};
68
69
70
#ifndef SIP_RUN
71
78
class
QmlExpression :
public
QObject
79
{
80
Q_OBJECT
81
82
public
:
84
void
setExpressionContext(
const
QgsExpressionContext
&context );
85
87
Q_INVOKABLE QVariant evaluate(
const
QString &expression )
const
;
88
89
private
:
90
QgsExpressionContext
mExpressionContext;
91
};
93
#endif //SIP_RUN
94
95
#endif // QGSQMLWIDGETWRAPPER_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:369
QgsWidgetWrapper::initWidget
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
Definition:
qgswidgetwrapper.cpp:106
QgsWidgetWrapper::valid
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
QgsWidgetWrapper
Definition:
qgswidgetwrapper.h:52
QgsQmlWidgetWrapper
Definition:
qgsqmlwidgetwrapper.h:29
qgis_sip.h
QgsWidgetWrapper::setFeature
virtual void setFeature(const QgsFeature &feature)=0
Is called, when the value of the widget needs to be changed.
QgsVectorLayer
Definition:
qgsvectorlayer.h:385
qgswidgetwrapper.h
QgsFeature
Definition:
qgsfeature.h:55
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
Generated on Mon Jun 22 2020 05:14:09 for QGIS API Documentation by
1.8.17