File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ void QgsPhotoWidgetWrapper::selectFileName()
38
38
39
39
void QgsPhotoWidgetWrapper::loadPixmap ( const QString &fileName )
40
40
{
41
+ if ( mWebView )
42
+ {
43
+ mWebView ->setUrl ( fileName );
44
+ }
45
+
41
46
QPixmap pm ( fileName );
42
47
if ( !pm.isNull () && mPhotoLabel )
43
48
{
@@ -53,7 +58,6 @@ void QgsPhotoWidgetWrapper::loadPixmap( const QString &fileName )
53
58
54
59
pm = pm.scaled ( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
55
60
56
-
57
61
mPhotoLabel ->setPixmap ( pm );
58
62
mPhotoLabel ->setMinimumSize ( size );
59
63
}
@@ -98,9 +102,17 @@ void QgsPhotoWidgetWrapper::initWidget( QWidget* editor )
98
102
QWidget* container;
99
103
100
104
mLineEdit = qobject_cast<QLineEdit*>( editor );
105
+ mWebView = qobject_cast<QWebView*>( editor );
101
106
102
107
if ( mLineEdit )
103
- container = qobject_cast<QWidget*>( mLineEdit ->parent () );
108
+ {
109
+ container = mLineEdit ->parentWidget ();
110
+ }
111
+ else if ( mWebView )
112
+ {
113
+ container = mWebView ->parentWidget ();
114
+ mLineEdit = container->findChild <QLineEdit*>();
115
+ }
104
116
else
105
117
{
106
118
container = editor;
@@ -141,6 +153,10 @@ void QgsPhotoWidgetWrapper::setValue( const QVariant& value )
141
153
else
142
154
mLineEdit ->setText ( value.toString () );
143
155
}
156
+ else
157
+ {
158
+ loadPixmap ( value.toString () );
159
+ }
144
160
}
145
161
146
162
void QgsPhotoWidgetWrapper::setEnabled ( bool enabled )
Original file line number Diff line number Diff line change 21
21
#include < QLabel>
22
22
#include < QPushButton>
23
23
#include < QLineEdit>
24
+ #include < QWebView>
24
25
25
26
26
27
/* *
@@ -60,6 +61,8 @@ class GUI_EXPORT QgsPhotoWidgetWrapper : public QgsEditorWidgetWrapper
60
61
private:
61
62
// ! This label is used as a container to display the picture
62
63
QLabel* mPhotoLabel ;
64
+ // ! This webview is used as a container to display the picture
65
+ QWebView* mWebView ;
63
66
// ! The line edit containing the path to the picture
64
67
QLineEdit* mLineEdit ;
65
68
// ! The button to open the file chooser dialog
You can’t perform that action at this time.
0 commit comments