RetroShare/retroshare-gui/src/gui/common/LinkTextBrowser.cpp
2012-02-11 13:42:42 +00:00

20 lines
500 B
C++

#include <QDesktopServices>
#include "LinkTextBrowser.h"
LinkTextBrowser::LinkTextBrowser(QWidget *parent) :
QTextBrowser(parent)
{
setOpenExternalLinks(true);
setOpenLinks(false);
connect(this, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
}
void LinkTextBrowser::linkClicked(const QUrl &url)
{
// some links are opened directly in the QTextBrowser with open external links set to true,
// so we handle links by our own
QDesktopServices::openUrl(url);
}