22 #include <QGridLayout> 32 , mFileWidgetVisible( true )
33 , mDocumentViewerContent( NoContent )
34 , mDocumentViewerHeight( 0 )
35 , mDocumentViewerWidth( 0 )
57 updateDocumentViewer();
90 return mFileWidgetVisible;
101 return mDocumentViewerContent;
106 mDocumentViewerContent = content;
107 updateDocumentViewer();
112 return mDocumentViewerHeight;
117 mDocumentViewerHeight =
height;
118 updateDocumentViewer();
123 return mDocumentViewerWidth;
128 mDocumentViewerWidth =
width;
129 updateDocumentViewer();
137 void QgsExternalResourceWidget::updateDocumentViewer()
140 mWebView->setVisible( mDocumentViewerContent ==
Web );
145 if ( mDocumentViewerContent ==
Image )
149 if ( !pm || pm->
isNull() )
155 QSize size( mDocumentViewerWidth, mDocumentViewerHeight );
174 QString QgsExternalResourceWidget::resolvePath(
const QString& path )
176 switch ( mRelativeStorage )
204 return mRelativeStorage;
213 void QgsExternalResourceWidget::loadDocument(
const QString& path )
220 if ( mDocumentViewerContent ==
Web )
222 mWebView->setUrl(
QUrl(
"about:blank" ) );
225 if ( mDocumentViewerContent ==
Image )
227 mPixmapLabel->
clear();
228 updateDocumentViewer();
233 resolvedPath = resolvePath( path );
236 if ( mDocumentViewerContent ==
Web )
238 mWebView->setUrl(
QUrl( resolvedPath ) );
242 if ( mDocumentViewerContent ==
Image )
246 updateDocumentViewer();
void setHeight(int height)
void setPixmap(const QPixmap &)
QString filePath(const QString &fileName) const
void setMargin(int margin)
QFileInfo fileInfo() const
Returns QFileInfo object for the project's associated file.
static QgsProject * instance()
Returns the QgsProject singleton instance.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
The QgsPixmapLabel class shows a pixmap and adjusts its size to the space given to the widget by the ...