Skip to content

Commit f5054ce

Browse files
committed
Allow compiling QGIS without QtWebkit
This allows to compile QGIS without webkit. 1. Webkit is soon-to-be deprecated 2. Webkit is not supported on Android 3. Who needs it anyway 4. The developer map on the about page is gone with webkit disabled 5. So is the information about plugins
1 parent 8abe726 commit f5054ce

22 files changed

+590
-56
lines changed

CMakeLists.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ SET (HAVE_SPATIALITE TRUE)
229229
# following variable is used in qgsconfig.h
230230
SET (HAVE_MSSQL TRUE)
231231

232+
SET (WITH_QTWEBKIT TRUE CACHE INTERNAL "Enable QtWebkit support")
233+
IF (WITH_QTWEBKIT)
234+
ADD_DEFINITIONS(-DWITH_QTWEBKIT)
235+
ENDIF(WITH_QTWEBKIT)
232236
#############################################################
233237
# search for Qt4
234238
SET(QT_MIN_VERSION 4.7.0)
@@ -243,8 +247,10 @@ IF (ENABLE_QT5)
243247
FIND_PACKAGE(Qt5Concurrent REQUIRED)
244248
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
245249
FIND_PACKAGE(Qt5Positioning)
246-
FIND_PACKAGE(Qt5WebKit REQUIRED)
247-
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
250+
IF (WITH_QTWEBKIT)
251+
FIND_PACKAGE(Qt5WebKit REQUIRED)
252+
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
253+
ENDIF(WITH_QTWEBKIT)
248254
FIND_PACKAGE(Qt5Test REQUIRED)
249255
FIND_PACKAGE(Qt5UiTools REQUIRED)
250256
FIND_PACKAGE(Qt5Script REQUIRED)

src/app/pluginmanager/qgspluginmanager.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <QActionGroup>
3131
#include <QTextStream>
3232
#include <QTimer>
33-
#include <QWebPage>
3433
#include <QDesktopServices>
3534

3635
#include "qgis.h"

src/app/qgsidentifyresultsdialog.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "qgsproject.h"
3434
#include "qgsrasterlayer.h"
3535
#include "qgsvectorlayer.h"
36+
#include "qgswebview.h"
37+
#include "qgswebframe.h"
3638

3739
#include <QCloseEvent>
3840
#include <QLabel>
@@ -45,13 +47,11 @@
4547
#include <QDockWidget>
4648
#include <QMenuBar>
4749
#include <QPushButton>
48-
#include <QWebView>
4950
#include <QPrinter>
5051
#include <QPrintDialog>
5152
#include <QDesktopServices>
5253
#include <QMessageBox>
5354
#include <QComboBox>
54-
#include <QWebFrame>
5555

5656
//graph
5757
#include <qwt_plot.h>
@@ -61,7 +61,7 @@
6161
#include "qgsvectorcolorrampv2.h" // for random colors
6262

6363

64-
QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QWebView( parent )
64+
QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QgsWebView( parent )
6565
{
6666
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
6767
page()->setNetworkAccessManager( QgsNetworkAccessManager::instance() );
@@ -80,7 +80,7 @@ void QgsIdentifyResultsWebView::print( void )
8080
QPrintDialog *dialog = new QPrintDialog( &printer );
8181
if ( dialog->exec() == QDialog::Accepted )
8282
{
83-
QWebView::print( &printer );
83+
QgsWebView::print( &printer );
8484
}
8585
}
8686

@@ -97,12 +97,12 @@ void QgsIdentifyResultsWebView::contextMenuEvent( QContextMenuEvent *e )
9797
delete menu;
9898
}
9999

100-
QWebView *QgsIdentifyResultsWebView::createWindow( QWebPage::WebWindowType type )
100+
QgsWebView *QgsIdentifyResultsWebView::createWindow( QWebPage::WebWindowType type )
101101
{
102102
QDialog *d = new QDialog( this );
103103
QLayout *l = new QVBoxLayout( d );
104104

105-
QWebView *wv = new QWebView( d );
105+
QgsWebView *wv = new QgsWebView( d );
106106
l->addWidget( wv );
107107

108108
wv->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );

src/app/qgsidentifyresultsdialog.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
#include "qgsmaptoolidentify.h"
2828
#include "qgscoordinatereferencesystem.h"
2929
#include "qgsmaplayeractionregistry.h"
30+
#include "qgswebview.h"
3031

3132
#include <QWidget>
3233
#include <QList>
33-
#include <QWebView>
3434

3535
class QCloseEvent;
3636
class QTreeWidgetItem;
@@ -49,7 +49,7 @@ class QwtPlotCurve;
4949
*@author Gary E.Sherman
5050
*/
5151

52-
class APP_EXPORT QgsIdentifyResultsWebView : public QWebView
52+
class APP_EXPORT QgsIdentifyResultsWebView : public QgsWebView
5353
{
5454
Q_OBJECT
5555
public:
@@ -59,7 +59,7 @@ class APP_EXPORT QgsIdentifyResultsWebView : public QWebView
5959
void print( void );
6060
protected:
6161
void contextMenuEvent( QContextMenuEvent* ) override;
62-
QWebView *createWindow( QWebPage::WebWindowType type ) override;
62+
QgsWebView *createWindow( QWebPage::WebWindowType type ) override;
6363
};
6464

6565
class APP_EXPORT QgsIdentifyResultsFeatureItem: public QTreeWidgetItem

src/core/CMakeLists.txt

+19-2
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ SET(QGIS_CORE_SRCS
291291
raster/qgshuesaturationfilter.cpp
292292
)
293293

294+
IF (NOT WITH_QTWEBKIT)
295+
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
296+
qgswebpage.cpp
297+
qgswebframe.cpp
298+
)
299+
ENDIF(NOT WITH_QTWEBKIT)
300+
294301
IF(ENABLE_MODELTEST)
295302
SET(MODELTEST_SRCS
296303
../../tests/qt_modeltest/modeltest.cpp
@@ -322,7 +329,6 @@ IF (WITH_INTERNAL_QEXTSERIALPORT)
322329
gps/qextserialport/qextserialport.cpp
323330
gps/qextserialport/qextserialenumerator.cpp
324331
)
325-
326332
IF(WIN32)
327333
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
328334
gps/qextserialport/win_qextserialport.cpp
@@ -388,6 +394,7 @@ SET(QGIS_CORE_MOC_HDRS
388394
qgsvectorlayercache.h
389395
qgsvectorlayerjoinbuffer.h
390396
qgsgeometryvalidator.h
397+
qgswebview.h
391398

392399
composer/qgsaddremoveitemcommand.h
393400
composer/qgscomposerlegend.h
@@ -438,6 +445,13 @@ SET(QGIS_CORE_MOC_HDRS
438445
layertree/qgslayertreeregistrybridge.h
439446
)
440447

448+
IF (NOT WITH_QTWEBKIT)
449+
SET(QGIS_CORE_MOC_HDRS ${QGIS_CORE_MOC_HDRS}
450+
qgswebpage.h
451+
qgswebframe.h
452+
)
453+
ENDIF(NOT WITH_QTWEBKIT)
454+
441455
IF (NOT QT5_BUILD)
442456
SET(QGIS_CORE_MOC_HDRS ${QGIS_CORE_MOC_HDRS}
443457
qgshttptransaction.h
@@ -572,12 +586,15 @@ SET(QGIS_CORE_HDRS
572586
qgsvectorlayerundocommand.h
573587
qgsvectorsimplifymethod.h
574588
qgsxmlutils.h
589+
qgswebpage.h
590+
qgswebframe.h
591+
qgswebview.h
575592

576593
diagram/qgsdiagram.h
577594
diagram/qgspiediagram.h
578595
diagram/qgstextdiagram.h
579596
diagram/qgshistogramdiagram.h
580-
597+
581598
effects/qgsimageoperation.h
582599
effects/qgspainteffect.h
583600
effects/qgseffectstack.h

src/core/composer/qgscomposerhtml.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
#include "qgsproject.h"
2727
#include "qgsdistancearea.h"
2828

29+
#include "qgswebpage.h"
30+
#include "qgswebframe.h"
31+
2932
#include <QCoreApplication>
3033
#include <QPainter>
31-
#include <QWebFrame>
32-
#include <QWebPage>
3334
#include <QImage>
3435
#include <QNetworkReply>
3536

src/core/composer/qgscomposerlabel.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@
2525
#include "qgsproject.h"
2626
#include "qgsdistancearea.h"
2727

28+
#include "qgswebview.h"
29+
#include "qgswebframe.h"
30+
#include "qgswebpage.h"
31+
2832
#include <QCoreApplication>
2933
#include <QDate>
3034
#include <QDomElement>
3135
#include <QPainter>
3236
#include <QSettings>
3337
#include <QTimer>
34-
#include <QWebFrame>
35-
#include <QWebPage>
3638
#include <QEventLoop>
3739

3840
QgsComposerLabel::QgsComposerLabel( QgsComposition *composition )

src/core/qgswebframe.cpp

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/***************************************************************************
2+
3+
----------------------------------------------------
4+
date : 19.5.2015
5+
copyright : (C) 2015 by Matthias Kuhn
6+
email : matthias (at) opengis.ch
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#include "qgswebframe.h"
17+
18+
QWebFrame::QWebFrame()
19+
{
20+
21+
}
22+
23+
void QWebFrame::setZoomFactor(qreal factor)
24+
{
25+
26+
}
27+
28+
void QWebFrame::setScrollBarPolicy(Qt::Orientation, Qt::ScrollBarPolicy)
29+
{
30+
31+
}
32+
33+
void QWebFrame::setHtml(const QString&, const QUrl)
34+
{
35+
36+
}
37+
38+
QSize QWebFrame::contentsSize() const
39+
{
40+
41+
}
42+
43+
void QWebFrame::render( QPainter*, const QRegion )
44+
{
45+
46+
}
47+
48+
void QWebFrame::addToJavaScriptWindowObject(const QString&, QObject*)
49+
{
50+
51+
}
52+

src/core/qgswebframe.h

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/***************************************************************************
2+
3+
----------------------------------------------------
4+
date : 19.5.2015
5+
copyright : (C) 2015 by Matthias Kuhn
6+
email : matthias (at) opengis.ch
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#ifndef QGSWEBFRAME_H
17+
#define QGSWEBFRAME_H
18+
19+
#ifdef WITH_QTWEBKIT
20+
#include <QtWebKit/QWebFrame>
21+
#else
22+
23+
#include <QObject>
24+
#include <QPainter>
25+
#include <QUrl>
26+
27+
class QWebFrame : public QObject
28+
{
29+
Q_OBJECT
30+
31+
public:
32+
QWebFrame( QObject* parent = 0 )
33+
:QObject( parent )
34+
{
35+
36+
}
37+
38+
void setZoomFactor( qreal factor )
39+
{
40+
Q_UNUSED( factor );
41+
}
42+
43+
void setScrollBarPolicy( Qt::Orientation orientation, Qt::ScrollBarPolicy scrollbarpolicy )
44+
{
45+
Q_UNUSED( orientation );
46+
Q_UNUSED( scrollbarpolicy );
47+
}
48+
49+
void setHtml( const QString& html, const QUrl& url = QUrl() )
50+
{
51+
Q_UNUSED( html );
52+
Q_UNUSED( url );
53+
}
54+
55+
QSize contentsSize() const
56+
{
57+
return QSize();
58+
}
59+
60+
void render( QPainter*, const QRegion = QRegion() )
61+
{
62+
63+
}
64+
65+
void addToJavaScriptWindowObject( const QString&, QObject* )
66+
{
67+
68+
}
69+
70+
signals:
71+
void javaScriptWindowObjectCleared();
72+
};
73+
#endif
74+
#endif // QGSWEBFRAME_H

0 commit comments

Comments
 (0)