QGIS API Documentation  2.14.0-Essen
qgsexternalresourcewidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsexternalresourcewidget.h
3 
4  ---------------------
5  begin : 16.12.2015
6  copyright : (C) 2015 by Denis Rouzaud
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 
17 #ifndef QGSEXTERNALRESOURCEWIDGET_H
18 #define QGSEXTERNALRESOURCEWIDGET_H
19 
20 class QWebView;
21 class QgsPixmapLabel;
22 
23 #include <QWidget>
24 #include <QVariant>
25 
26 #include "qgsfilewidget.h"
27 
28 
29 
30 
35 class GUI_EXPORT QgsExternalResourceWidget : public QWidget
36 {
37 
38  Q_OBJECT
39  Q_PROPERTY( bool fileWidgetVisible READ fileWidgetVisible WRITE setFileWidgetVisible )
40  Q_PROPERTY( DocumentViewerContent documentViewerContent READ documentViewerContent WRITE setDocumentViewerContent )
41  Q_PROPERTY( int documentViewerHeight READ documentViewerHeight WRITE setDocumentViewerHeight )
42  Q_PROPERTY( int documentViewerWidth READ documentViewerWidth WRITE setDocumentViewerWidth )
43 
44  public:
46  {
49  Web
50  };
51 
57  explicit QgsExternalResourceWidget( QWidget *parent = 0 );
58 
63  QVariant documentPath( QVariant::Type type = QVariant::String ) const;
64  void setDocumentPath( const QVariant& documentPath );
65 
67  QgsFileWidget* fileWidget();
68 
70  bool fileWidgetVisible() const;
72  void setFileWidgetVisible( bool visible );
73 
75  QgsExternalResourceWidget::DocumentViewerContent documentViewerContent() const;
77  void setDocumentViewerContent( QgsExternalResourceWidget::DocumentViewerContent content );
78 
80  int documentViewerHeight() const;
85  void setDocumentViewerHeight( int height );
87  int documentViewerWidth() const ;
92  void setDocumentViewerWidth( int width );
93 
95  void setReadOnly( bool readOnly );
96 
97  signals:
99  void valueChanged( const QString& );
100 
101  private slots:
102  void loadDocument( const QString& path );
103 
104  private:
105  void updateDocumentViewer();
106 
108  bool mFileWidgetVisible;
109  DocumentViewerContent mDocumentViewerContent;
110  int mDocumentViewerHeight;
111  int mDocumentViewerWidth;
112 
114  QgsFileWidget* mFileWidget;
115  QgsPixmapLabel* mPixmapLabel;
116 #ifdef WITH_QTWEBKIT
117  QWebView* mWebView;
119 #endif
120 
121 };
122 
123 #endif // QGSEXTERNALRESOURCEWIDGET_H
The QgsFileWidget class creates a widget for selecting a file or a folder.
Definition: qgsfilewidget.h:31
Widget to display file path with a push button for an "open file" dialog It can also be used to displ...
The QgsPixmapLabel class shows a pixmap and adjusts its size to the space given to the widget by the ...