QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsphotowidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsphotowidgetwrapper.h
3  --------------------------------------
4  Date : 5.1.2014
5  Copyright : (C) 2014 Matthias Kuhn
6  Email : matthias dot kuhn at gmx dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSPHOTOWIDGETWRAPPER_H
17 #define QGSPHOTOWIDGETWRAPPER_H
18 
19 #include "qgseditorwidgetwrapper.h"
20 
21 #include <QLabel>
22 #include <QPushButton>
23 #include <QLineEdit>
24 #include "qgswebview.h"
25 
39 {
40  Q_OBJECT
41  public:
42  explicit QgsPhotoWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 );
43 
44  // QgsEditorWidgetWrapper interface
45  public:
46  QVariant value() override;
47 
48  protected:
49  QWidget* createWidget( QWidget* parent ) override;
50  void initWidget( QWidget* editor ) override;
51 
52  public slots:
53  void setValue( const QVariant& value ) override;
54  void setEnabled( bool enabled ) override;
55 
56  private slots:
57  void selectFileName();
58  void loadPixmap( const QString& fileName );
59 
60  private:
62  QLabel* mPhotoLabel;
63 #ifdef WITH_QTWEBKIT
64  QWebView* mWebView;
66 #endif
67  QLineEdit* mLineEdit;
70  QPushButton* mButton;
71 };
72 
73 #endif // QGSPHOTOWIDGETWRAPPER_H
Manages an editor widget Widget and wrapper share the same parent.
virtual QVariant value()=0
Will be used to access the widget's value.
void setEnabled(bool enabled) override
Is used to enable or disable the edit functionality of the managed widget.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
virtual void setValue(const QVariant &value)=0
Is called, when the value of the widget needs to be changed.
Wraps a photo widget.
Represents a vector layer which manages a vector based data sets.