sctextbrowser.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <QApplication>
00009 #include <QCursor>
00010 #include <QFileDialog>
00011 #include <QFileInfo>
00012 #include <QMessageBox>
00013 #include <QProcess>
00014 #include <QString>
00015 #include <QStringList>
00016 #include <QToolTip>
00017 #include <QUrl>
00018
00019 #if defined(_WIN32)
00020 #include <windows.h>
00021 #include <shellapi.h>
00022 #endif
00023
00024 #include "prefsmanager.h"
00025 #include "sctextbrowser.h"
00026 #include "urllauncher.h"
00027
00028 ScTextBrowser::ScTextBrowser( QWidget * parent )
00029 : QTextBrowser(parent)
00030 {
00031 setOpenLinks(false);
00032 connect(this, SIGNAL(highlighted(const QString &)), this, SLOT(hoverMouse(const QString &)));
00033 connect(this, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(navigateOverride(const QUrl &)));
00034 }
00035
00036 void ScTextBrowser::hoverMouse(const QString &link)
00037 {
00038 if (link.isEmpty())
00039 qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
00040 else
00041 {
00042 qApp->changeOverrideCursor(QCursor(Qt::PointingHandCursor));
00043
00044
00045 }
00046 emit overLink(link);
00047 }
00048
00049 void ScTextBrowser::navigateOverride(const QUrl & link)
00050 {
00051 if (link.scheme()=="http")
00052 UrlLauncher::instance()->launchUrlExt(link, parentWidget());
00053 else
00054 setSource(link);
00055 }