mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Merge pull request #1 from nbq/fortriplelexx
Clickable Links In InfoView
This commit is contained in:
commit
f615915fba
2 changed files with 10 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileInfo>
|
||||
#include <QtWebKitWidgets/QWebFrame>
|
||||
#include <QtWebKit/QWebElement>
|
||||
|
@ -32,6 +33,9 @@ InfoView::InfoView(bool forced, QString path) :
|
|||
QString absPath = QFileInfo(PathUtils::resourcesPath() + path).absoluteFilePath();
|
||||
QUrl url = QUrl::fromLocalFile(absPath);
|
||||
|
||||
page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
|
||||
connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClickedInfoView(QUrl)));
|
||||
|
||||
load(url);
|
||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
|
||||
}
|
||||
|
@ -83,3 +87,8 @@ void InfoView::loaded(bool ok) {
|
|||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
show();
|
||||
}
|
||||
|
||||
void InfoView::linkClickedInfoView(QUrl url) {
|
||||
close();
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ private:
|
|||
|
||||
private slots:
|
||||
void loaded(bool ok);
|
||||
void linkClickedInfoView(QUrl url);
|
||||
};
|
||||
|
||||
#endif // hifi_InfoView_h
|
||||
|
|
Loading…
Reference in a new issue