Skip to content
Permalink
Browse files
identify results: use webview also for text/plain
  • Loading branch information
blazek committed Feb 13, 2014
1 parent 2a4f104 commit 3215f499b2fad3eace2f73adc4f4e95fe6c6cf7f
Showing with 9 additions and 2 deletions.
  1. +7 −2 src/app/qgsidentifyresultsdialog.cpp
  2. +2 −0 src/app/qgsidentifyresultsdialog.h
@@ -205,6 +205,11 @@ void QgsIdentifyResultsWebViewItem::setHtml( const QString &html )
mWebView->setHtml( html );
}

void QgsIdentifyResultsWebViewItem::setContent( const QByteArray & data, const QString & mimeType, const QUrl & baseUrl )
{
mWebView->setContent( data, mimeType, baseUrl );
}

QgsIdentifyResultsWebViewItem::QgsIdentifyResultsWebViewItem( QTreeWidget *treeWidget )
{
mWebView = new QgsIdentifyResultsWebView( treeWidget );
@@ -544,11 +549,11 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
}
}

if ( currentFormat == QgsRaster::IdentifyFormatHtml )
if ( currentFormat == QgsRaster::IdentifyFormatHtml || currentFormat == QgsRaster::IdentifyFormatText )
{
QgsIdentifyResultsWebViewItem *attrItem = new QgsIdentifyResultsWebViewItem( lstResults );
featItem->addChild( attrItem ); // before setHtml()!
attrItem->setHtml( attributes.begin().value() );
attrItem->setContent( attributes.begin().value().toUtf8(), currentFormat == QgsRaster::IdentifyFormatHtml ? "text/html" : "text/plain" );
}
else
{
@@ -82,6 +82,8 @@ class APP_EXPORT QgsIdentifyResultsWebViewItem: public QObject, public QTreeWidg
QgsIdentifyResultsWebViewItem( QTreeWidget *treeWidget = 0 );
QgsIdentifyResultsWebView *webView() { return mWebView; }
void setHtml( const QString &html );
/** @note added in 2.1 */
void setContent( const QByteArray & data, const QString & mimeType = QString(), const QUrl & baseUrl = QUrl() );

public slots:
void loadFinished( bool ok );

0 comments on commit 3215f49

Please sign in to comment.