Skip to content

Commit

Permalink
identify results: use webview also for text/plain
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Feb 13, 2014
1 parent 2a4f104 commit 3215f49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsidentifyresultsdialog.h
Expand Up @@ -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 );
Expand Down

0 comments on commit 3215f49

Please sign in to comment.