Skip to content

Commit

Permalink
allow popups from html wms responses
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 6, 2013
1 parent 97d006c commit 5af75da
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -57,6 +57,7 @@ QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QWebVi
// page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
page()->setLinkDelegationPolicy( QWebPage::DontDelegateLinks );
settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true );
settings()->setAttribute( QWebSettings::JavascriptCanOpenWindows, true );
#ifdef QGISDEBUG
settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
#endif
Expand Down Expand Up @@ -85,6 +86,28 @@ void QgsIdentifyResultsWebView::contextMenuEvent( QContextMenuEvent *e )
delete menu;
}

QWebView *QgsIdentifyResultsWebView::createWindow( QWebPage::WebWindowType type )
{
QDialog *d = new QDialog( this );
QLayout *l = new QVBoxLayout( d );

QWebView *wv = new QWebView( d );
l->addWidget( wv );

wv->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
wv->page()->setNetworkAccessManager( QgsNetworkAccessManager::instance() );
wv->settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true );
wv->settings()->setAttribute( QWebSettings::JavascriptCanOpenWindows, true );
#ifdef QGISDEBUG
wv->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
#endif

d->setModal( type != QWebPage::WebBrowserWindow );
d->show();

return wv;
}

// QgsIdentifyResultsWebView size:
// ---------------
//
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsidentifyresultsdialog.h
Expand Up @@ -56,6 +56,7 @@ class QgsIdentifyResultsWebView : public QWebView
void print( void );
protected:
void contextMenuEvent( QContextMenuEvent* );
QWebView *createWindow( QWebPage::WebWindowType type );
};

class QgsIdentifyResultsFeatureItem: public QTreeWidgetItem
Expand Down

0 comments on commit 5af75da

Please sign in to comment.