allow both QtWebKit and QtWebEngine since a lot of distros are not ready yet for QtWebEngine.
This commit is contained in:
parent
b1fce70959
commit
bfbdb5af4b
@ -28,7 +28,11 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
#ifdef HAVE_QT_WEB_ENGINE
|
||||||
#include <QWebEngineView>
|
#include <QWebEngineView>
|
||||||
|
#else
|
||||||
|
#include <QtWebKitWidgets>
|
||||||
|
#endif
|
||||||
#include <QNetworkProxyFactory>
|
#include <QNetworkProxyFactory>
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
@ -55,7 +59,11 @@ PHelp::PHelp(const QString &url, const bool isDarkTheme) :
|
|||||||
|
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
|
|
||||||
|
#ifdef HAVE_QT_WEB_ENGINE
|
||||||
fView = new QWebEngineView(this);
|
fView = new QWebEngineView(this);
|
||||||
|
#else
|
||||||
|
fView = new QWebView(this);
|
||||||
|
#endif
|
||||||
fView->load(QUrl(url));
|
fView->load(QUrl(url));
|
||||||
connect(fView, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
|
connect(fView, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
|
||||||
connect(fView, SIGNAL(titleChanged(QString)), SLOT(adjustTitle()));
|
connect(fView, SIGNAL(titleChanged(QString)), SLOT(adjustTitle()));
|
||||||
@ -67,10 +75,17 @@ PHelp::PHelp(const QString &url, const bool isDarkTheme) :
|
|||||||
connect(fLocationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));
|
connect(fLocationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));
|
||||||
|
|
||||||
QToolBar *toolBar = addToolBar(tr("Navigation"));
|
QToolBar *toolBar = addToolBar(tr("Navigation"));
|
||||||
|
#ifdef HAVE_QT_WEB_ENGINE
|
||||||
toolBar->addAction(fView->pageAction(QWebEnginePage::Back));
|
toolBar->addAction(fView->pageAction(QWebEnginePage::Back));
|
||||||
toolBar->addAction(fView->pageAction(QWebEnginePage::Forward));
|
toolBar->addAction(fView->pageAction(QWebEnginePage::Forward));
|
||||||
toolBar->addAction(fView->pageAction(QWebEnginePage::Reload));
|
toolBar->addAction(fView->pageAction(QWebEnginePage::Reload));
|
||||||
toolBar->addAction(fView->pageAction(QWebEnginePage::Stop));
|
toolBar->addAction(fView->pageAction(QWebEnginePage::Stop));
|
||||||
|
#else
|
||||||
|
toolBar->addAction(fView->pageAction(QWebPage::Back));
|
||||||
|
toolBar->addAction(fView->pageAction(QWebPage::Forward));
|
||||||
|
toolBar->addAction(fView->pageAction(QWebPage::Reload));
|
||||||
|
toolBar->addAction(fView->pageAction(QWebPage::Stop));
|
||||||
|
#endif
|
||||||
toolBar->addWidget(fLocationEdit);
|
toolBar->addWidget(fLocationEdit);
|
||||||
|
|
||||||
QMenu *exitMenu = menuBar()->addMenu(tr("&File"));
|
QMenu *exitMenu = menuBar()->addMenu(tr("&File"));
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
|
#ifdef HAVE_QT_WEB_ENGINE
|
||||||
class QWebEngineView;
|
class QWebEngineView;
|
||||||
|
#else
|
||||||
|
class QWebView;
|
||||||
|
#endif
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@ -60,7 +64,11 @@ class PHelp : public QMainWindow
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool fDarkTheme;
|
bool fDarkTheme;
|
||||||
|
#ifdef HAVE_QT_WEB_ENGINE
|
||||||
QWebEngineView *fView; ///< web viewer
|
QWebEngineView *fView; ///< web viewer
|
||||||
|
#else
|
||||||
|
QWebView *fView; ///< web viewer
|
||||||
|
#endif
|
||||||
QLineEdit *fLocationEdit; ///< url address line edit
|
QLineEdit *fLocationEdit; ///< url address line edit
|
||||||
int fProgress; ///< progress value (0-100) while loading an url
|
int fProgress; ///< progress value (0-100) while loading an url
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = musredit
|
TARGET = musredit
|
||||||
|
|
||||||
|
packagesExist(Qt5WebEngine) {
|
||||||
|
message("Qt5WebEngine found")
|
||||||
|
DEFINES += HAVE_QT_WEB_ENGINE
|
||||||
|
HAVE_QT_WEB_ENGINE = 1
|
||||||
|
}
|
||||||
|
packagesExist(QtWebKit) {
|
||||||
|
message("QtWebKit found")
|
||||||
|
HAVE_QT_WEB_ENGINE = 0
|
||||||
|
}
|
||||||
|
isEmpty(HAVE_QT_WEB_ENGINE) {
|
||||||
|
message("Neither QtWebKit nor Qt5WebEngine found. Something is wrong, please check")
|
||||||
|
}
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -std=c++11
|
QMAKE_CXXFLAGS += -std=c++11
|
||||||
|
|
||||||
# install path for musredit
|
# install path for musredit
|
||||||
@ -71,7 +84,12 @@ CONFIG += qt \
|
|||||||
|
|
||||||
QT += widgets
|
QT += widgets
|
||||||
QT += xml
|
QT += xml
|
||||||
QT += webenginewidgets
|
isEqual(HAVE_QT_WEB_ENGINE, 1) {
|
||||||
|
QT += webenginewidgets
|
||||||
|
}
|
||||||
|
isEqual(HAVE_QT_WEB_ENGINE, 0) {
|
||||||
|
QT += webkitwidgets
|
||||||
|
}
|
||||||
QT += network
|
QT += network
|
||||||
QT += printsupport
|
QT += printsupport
|
||||||
QT += svg
|
QT += svg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user