[Qt] Fix build against Qt5 after refactor of widgets out of QtGUi
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 19:31:59 +0000 (19:31 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Sep 2011 19:31:59 +0000 (19:31 +0000)
QWidget and friends now live in the QtWidgets library. We update
includes in implementation files and private headers to us the
non-module-prefixed path, and leave the lookup for the include
path. For public headers we have to ifdef the includes as the
user might now have the modules we need in his QT config.

Finally, QSGCanvas is no longer a QWidget but a QWindow, so we
have to update our code and use windowHandle() for setting the
parent relationships.

https://bugs.webkit.org/show_bug.cgi?id=68687

Reviewed by Andreas Kling.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96345 268f45cc-cd09-0410-ab3c-d52691b4dbfc

55 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/WebCore.pri
Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
Source/WebKit.pro
Source/WebKit/qt/Api/qgraphicswebview.cpp
Source/WebKit/qt/Api/qgraphicswebview.h
Source/WebKit/qt/Api/qwebframe.h
Source/WebKit/qt/Api/qwebhistory.h
Source/WebKit/qt/Api/qwebpage.h
Source/WebKit/qt/Api/qwebsettings.h
Source/WebKit/qt/Api/qwebview.h
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/QtWebKit.pro
Source/WebKit/qt/WebCoreSupport/PageClientQt.h
Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp
Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h
Source/WebKit/qt/declarative/declarative.pro
Source/WebKit/qt/declarative/qdeclarativewebview.cpp
Source/WebKit/qt/declarative/qdeclarativewebview_p.h
Source/WebKit/qt/docs/webkitsnippets/webpage/main.cpp
Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h
Source/WebKit/qt/tests/tests.pri
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
Source/WebKit2/UIProcess/API/qt/tests/tests.pri
Source/WebKit2/UIProcess/API/qt/tests/tests.pro
Source/WebKit2/UIProcess/qt/ViewInterface.h
Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp
Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTree.pro
Tools/DumpRenderTree/qt/ImageDiff.pro
Tools/MiniBrowser/qt/BrowserView.cpp
Tools/MiniBrowser/qt/BrowserView.h
Tools/MiniBrowser/qt/BrowserWindow.cpp
Tools/MiniBrowser/qt/BrowserWindow.h
Tools/MiniBrowser/qt/MiniBrowser.pro
Tools/MiniBrowser/qt/MiniBrowserApplication.h
Tools/MiniBrowser/qt/main.cpp
Tools/QtTestBrowser/QtTestBrowser.pro
Tools/QtTestBrowser/launcherwindow.cpp
Tools/QtTestBrowser/launcherwindow.h
Tools/QtTestBrowser/locationedit.h
Tools/QtTestBrowser/main.cpp
Tools/QtTestBrowser/mainwindow.cpp
Tools/QtTestBrowser/mainwindow.h
Tools/QtTestBrowser/webinspector.h
Tools/QtTestBrowser/webpage.cpp
Tools/QtTestBrowser/webview.cpp
Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp
Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp
Tools/WebKitTestRunner/qt/WebKitTestRunner.pro

index 94fe4a0..32c316f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2011-09-23  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi
+
+        QWidget and friends now live in the QtWidgets library. We update
+        includes in implementation files and private headers to us the
+        non-module-prefixed path, and leave the lookup for the include
+        path. For public headers we have to ifdef the includes as the
+        user might now have the modules we need in his QT config.
+
+        Finally, QSGCanvas is no longer a QWidget but a QWindow, so we
+        have to update our code and use windowHandle() for setting the
+        parent relationships.
+
+        https://bugs.webkit.org/show_bug.cgi?id=68687
+
+        Reviewed by Andreas Kling.
+
+        * Source/WebKit.pro:
+
 2011-09-29  Sergio Villar Senin  <svillar@igalia.com>
 
         [GTK] Bump version to 1.7.0
index 9418ed8..62786ac 100644 (file)
@@ -1,3 +1,24 @@
+2011-09-23  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi
+
+        QWidget and friends now live in the QtWidgets library. We update
+        includes in implementation files and private headers to us the
+        non-module-prefixed path, and leave the lookup for the include
+        path. For public headers we have to ifdef the includes as the
+        user might now have the modules we need in his QT config.
+
+        Finally, QSGCanvas is no longer a QWidget but a QWindow, so we
+        have to update our code and use windowHandle() for setting the
+        parent relationships.
+
+        https://bugs.webkit.org/show_bug.cgi?id=68687
+
+        Reviewed by Andreas Kling.
+
+        * WebCore.pri:
+        * platform/graphics/qt/GraphicsLayerQt.cpp:
+
 2011-09-29  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r96340.
index ff978ee..869fead 100644 (file)
@@ -332,7 +332,10 @@ unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections
 unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections
 linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
 
-unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
+unix|win32-g++* {
+    QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
+    greaterThan(QT_MAJOR_VERSION, 4): QMAKE_PKGCONFIG_REQUIRES += QtWidgets
+}
 unix:!mac:!symbian:CONFIG += link_pkgconfig
 
 # Disable C++0x mode in WebCore for those who enabled it in their Qt's mkspec
index 6765799..3609d85 100644 (file)
 #include "RefCounted.h"
 #include "TranslateTransformOperation.h"
 #include "UnitBezier.h"
+#include <qgraphicseffect.h>
+#include <qgraphicsitem.h>
+#include <qgraphicsscene.h>
+#include <qgraphicsview.h>
+#include <qgraphicswidget.h>
+#include <qstyleoption.h>
 #include <QtCore/qabstractanimation.h>
 #include <QtCore/qdatetime.h>
 #include <QtCore/qdebug.h>
 #include <QtCore/qset.h>
 #include <QtCore/qtimer.h>
 #include <QtGui/qcolor.h>
-#include <QtGui/qgraphicseffect.h>
-#include <QtGui/qgraphicsitem.h>
-#include <QtGui/qgraphicsscene.h>
-#include <QtGui/qgraphicsview.h>
-#include <QtGui/qgraphicswidget.h>
 #include <QtGui/qpainter.h>
 #include <QtGui/qpixmap.h>
 #include <QtGui/qpixmapcache.h>
-#include <QtGui/qstyleoption.h>
 
 #if ENABLE(TILED_BACKING_STORE)
 #include "TiledBackingStore.h"
index 741d476..169a4ee 100644 (file)
@@ -17,6 +17,13 @@ webkit2 {
     exists($$PWD/WebKit2/WebKit2.pro): SUBDIRS += WebKit2/WebKit2.pro
 }
 
+greaterThan(QT_MAJOR_VERSION, 4) {
+    isEmpty(QT.widgets.name)|isEmpty(QT.printsupport.name) {
+        message("Building WebKit against Qt 5.0 requires the QtWidgets and QtPrintSupport modules.")
+        error("Aborting build.")
+    }
+}
+
 SUBDIRS += WebCore
 SUBDIRS += WebKit/qt/QtWebKit.pro
 
index 2bd237f..e078ddc 100644 (file)
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "TiledBackingStore.h"
+#include <qapplication.h>
+#include <qgraphicsscene.h>
+#include <qgraphicssceneevent.h>
+#include <qgraphicsview.h>
+#include <qscrollbar.h>
+#include <qstyleoption.h>
+#include <qinputcontext.h>
 #include <QtCore/qmetaobject.h>
 #include <QtCore/qsharedpointer.h>
 #include <QtCore/qtimer.h>
-#include <QtGui/qapplication.h>
-#include <QtGui/qgraphicsscene.h>
-#include <QtGui/qgraphicssceneevent.h>
-#include <QtGui/qgraphicsview.h>
 #include <QtGui/qpixmapcache.h>
-#include <QtGui/qscrollbar.h>
-#include <QtGui/qstyleoption.h>
-#include <QtGui/qinputcontext.h>
+
 #if defined(Q_WS_X11)
 #include <QX11Info>
 #endif
index ceb0ad8..29e7ffd 100644 (file)
 #include "qwebkitglobal.h"
 #include "qwebpage.h"
 #include <QtCore/qurl.h>
-#include <QtGui/qevent.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets/qgraphicswidget.h>
+#include <QtWidgets/qicon.h>
+#else
 #include <QtGui/qgraphicswidget.h>
 #include <QtGui/qicon.h>
+#endif
+#include <QtGui/qevent.h>
 #include <QtGui/qpainter.h>
 #include <QtNetwork/qnetworkaccessmanager.h>
 
index 262fe7d..35fce4b 100644 (file)
 #include <QtCore/qobject.h>
 #include <QtCore/qurl.h>
 #include <QtCore/qvariant.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets/qicon.h>
+#else
 #include <QtGui/qicon.h>
+#endif
 #include <QtScript/qscriptengine.h>
 #include <QtNetwork/qnetworkaccessmanager.h>
 #include "qwebkitglobal.h"
index 3456784..0d59041 100644 (file)
 
 #include <QtCore/qurl.h>
 #include <QtCore/qstring.h>
-#include <QtGui/qicon.h>
 #include <QtCore/qdatetime.h>
 #include <QtCore/qshareddata.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets/qicon.h>
+#else
+#include <QtGui/qicon.h>
+#endif
 
 #include "qwebkitglobal.h"
 
index 21083d8..fd2fd4b 100644 (file)
 
 #include <QtCore/qobject.h>
 #include <QtCore/qurl.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets/qwidget.h>
+#else
 #include <QtGui/qwidget.h>
+#endif
 
 QT_BEGIN_NAMESPACE
 class QNetworkProxy;
index 18787d5..40f7f73 100644 (file)
 
 #include <QtCore/qstring.h>
 #include <QtGui/qpixmap.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets/qicon.h>
+#else
 #include <QtGui/qicon.h>
+#endif
 #include <QtCore/qshareddata.h>
 
 namespace WebCore {
index 70ee1fa..07e30d3 100644 (file)
 
 #include "qwebkitglobal.h"
 #include "qwebpage.h"
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets/qwidget.h>
+#include <QtWidgets/qicon.h>
+#else
 #include <QtGui/qwidget.h>
 #include <QtGui/qicon.h>
+#endif
 #include <QtGui/qpainter.h>
 #include <QtCore/qurl.h>
 #include <QtNetwork/qnetworkaccessmanager.h>
index 7c423ca..190ab1a 100644 (file)
@@ -1,3 +1,37 @@
+2011-09-23  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi
+
+        QWidget and friends now live in the QtWidgets library. We update
+        includes in implementation files and private headers to us the
+        non-module-prefixed path, and leave the lookup for the include
+        path. For public headers we have to ifdef the includes as the
+        user might now have the modules we need in his QT config.
+
+        Finally, QSGCanvas is no longer a QWidget but a QWindow, so we
+        have to update our code and use windowHandle() for setting the
+        parent relationships.
+
+        https://bugs.webkit.org/show_bug.cgi?id=68687
+
+        Reviewed by Andreas Kling.
+
+        * Api/qgraphicswebview.cpp:
+        * Api/qgraphicswebview.h:
+        * Api/qwebframe.h:
+        * Api/qwebhistory.h:
+        * Api/qwebpage.h:
+        * Api/qwebsettings.h:
+        * Api/qwebview.h:
+        * QtWebKit.pro:
+        * WebCoreSupport/PageClientQt.h:
+        * WebCoreSupport/QtWebComboBox.cpp:
+        * WebCoreSupport/QtWebComboBox.h:
+        * declarative/qdeclarativewebview.cpp:
+        * declarative/qdeclarativewebview_p.h:
+        * docs/webkitsnippets/webpage/main.cpp:
+        * examples/platformplugin/WebNotificationPresenter.h:
+
 2011-09-27  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r96108, r96111, r96113, and r96116.
index 060ad9f..e824598 100644 (file)
@@ -41,6 +41,7 @@ webkit2:prependWebKit2Lib(../../WebKit2)
 # the generated includes are containing the dependencies.
 # It used to be in WebCore.pro but now that this is the main pro file it has to be here.
 QT += network
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
 
 isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..
 
index d0f717f..c7b1439 100644 (file)
 #include "qwebframe_p.h"
 #include "qwebpage.h"
 #include "qwebpage_p.h"
+#include <qgraphicsscene.h>
+#include <qgraphicsview.h>
+#include <qgraphicswidget.h>
+#include <qscrollbar.h>
+#include <qstyleoption.h>
+#include <qwidget.h>
 #include <QtCore/qmetaobject.h>
-#include <QtGui/qgraphicsscene.h>
-#include <QtGui/qgraphicsview.h>
-#include <QtGui/qgraphicswidget.h>
-#include <QtGui/qscrollbar.h>
-#include <QtGui/qstyleoption.h>
-#include <QtGui/qwidget.h>
 
 #include <Settings.h>
 
index b6347fc..8a06d64 100644 (file)
@@ -24,8 +24,8 @@
 
 #ifndef QT_NO_COMBOBOX
 
-#include <QtGui/QAbstractItemView>
-#include <QtGui/QApplication>
+#include <QAbstractItemView>
+#include <QApplication>
 #include <QtGui/QMouseEvent>
 
 namespace WebCore {
index 6cc5f21..bca2e5f 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "Platform.h"
 
-#include <QtGui/QComboBox>
+#include <QComboBox>
 
 #ifndef QT_NO_COMBOBOX
 
index 6a3e24b..4b89d89 100644 (file)
@@ -40,6 +40,7 @@ symbian: {
 include(../../../WebKit.pri)
 
 QT += declarative
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 contains(QT_CONFIG, qtquick1): {
     QT += qtquick1
index 22ee579..4bf6e15 100644 (file)
 
 #include "qdeclarativewebview_p.h"
 
+#include <QApplication>
+#include <QGraphicsSceneMouseEvent>
 #include <QtCore/QDebug>
 #include <QtCore/QEvent>
 #include <QtCore/QFile>
 #include <QtDeclarative/QDeclarativeContext>
 #include <QtDeclarative/QDeclarativeEngine>
 #include <QtDeclarative/qdeclarative.h>
-#include <QtGui/QApplication>
-#include <QtGui/QGraphicsSceneMouseEvent>
 #include <QtGui/QKeyEvent>
 #include <QtGui/QMouseEvent>
 #include <QtGui/QPen>
index 9fcd3ef..83463db 100644 (file)
 
 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 #include <QtQuick1/QDeclarativeItem>
+#include <QtWidgets/QAction>
 #else
 #include <QtDeclarative/QDeclarativeItem>
+#include <QtGui/QAction>
 #endif
 
-#include <QtGui/QAction>
 #include <QtNetwork/QNetworkAccessManager>
 #include "qgraphicswebview.h"
 #include "qwebpage.h"
index 393b16a..491935a 100644 (file)
     Boston, MA 02110-1301, USA.
 */
 
-#include <QtGui>
-#include <QWebPage>
+#include <QApplication>
+#include <QPainter>
 #include <QWebFrame>
+#include <QWebPage>
 
 //! [0]
 class Thumbnailer : public QObject
index f46e5cb..4b1bb98 100644 (file)
 #define WebNotificationPresenter_h
 
 #include "qwebkitplatformplugin.h"
-#include <QtGui>
+
+#include <QBitmap>
+#include <QEvent>
+#include <QGridLayout>
+#include <QLabel>
+#include <QPainter>
+#include <QWidget>
 
 class WebNotificationWidget : public QWidget
 {
index 2b0c347..fa83e1f 100644 (file)
@@ -21,6 +21,7 @@ INCLUDEPATH += \
 
 include(../../../WebKit.pri)
 QT += testlib network
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 lessThan(QT_MAJOR_VERSION, 5) {
     contains(QT_CONFIG, declarative): QT += declarative
index 255b913..89ba4c4 100644 (file)
@@ -1,3 +1,27 @@
+2011-09-23  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi
+
+        QWidget and friends now live in the QtWidgets library. We update
+        includes in implementation files and private headers to us the
+        non-module-prefixed path, and leave the lookup for the include
+        path. For public headers we have to ifdef the includes as the
+        user might now have the modules we need in his QT config.
+
+        Finally, QSGCanvas is no longer a QWidget but a QWindow, so we
+        have to update our code and use windowHandle() for setting the
+        parent relationships.
+
+        https://bugs.webkit.org/show_bug.cgi?id=68687
+
+        Reviewed by Andreas Kling.
+
+        * UIProcess/API/qt/qdesktopwebview.cpp:
+        * UIProcess/API/qt/qdesktopwebview.h:
+        * UIProcess/API/qt/tests/tests.pro:
+        * UIProcess/qt/ViewInterface.h:
+        * UIProcess/qt/WebPopupMenuProxyQtDesktop.cpp:
+
 2011-09-29  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Force single header include in WebKit2 GTK+ API
index 380214c..27ed106 100644 (file)
@@ -23,6 +23,8 @@
 #include "qdesktopwebview_p.h"
 #include "qweberror.h"
 
+#include <QFileDialog>
+#include <QGraphicsSceneEvent>
 #include <QGraphicsSceneResizeEvent>
 #include <QStyleOptionGraphicsItem>
 #include <QtDeclarative/qdeclarativeengine.h>
@@ -31,9 +33,8 @@
 #include <QtDeclarative/qsgitem.h>
 #include <QtDeclarative/qsgview.h>
 #include <QtGui/QCursor>
-#include <QtGui/QFileDialog>
+#include <QtGui/QDrag>
 #include <QtGui/QFocusEvent>
-#include <QtGui/QGraphicsSceneEvent>
 #include <QtGui/QHoverEvent>
 #include <QtGui/QInputMethodEvent>
 #include <QtGui/QKeyEvent>
@@ -81,16 +82,16 @@ bool QDesktopWebViewPrivate::isVisible()
 
 void QDesktopWebViewPrivate::startDrag(Qt::DropActions supportedDropActions, const QImage& dragImage, QMimeData* data, QPoint* clientPosition, QPoint* globalPosition, Qt::DropAction* dropAction)
 {
-    QWidget* widget = q->canvas();
-    if (!widget)
+    QWindow* window = q->canvas();
+    if (!window)
         return;
 
-    QDrag* drag = new QDrag(widget);
+    QDrag* drag = new QDrag(window);
     drag->setPixmap(QPixmap::fromImage(dragImage));
     drag->setMimeData(data);
     *dropAction = drag->exec(supportedDropActions);
     *globalPosition = QCursor::pos();
-    *clientPosition = widget->mapFromGlobal(*globalPosition);
+    *clientPosition = window->mapFromGlobal(*globalPosition);
 }
 
 void QDesktopWebViewPrivate::didReceiveViewportArguments(const WebCore::ViewportArguments&)
@@ -116,7 +117,6 @@ void QDesktopWebViewPrivate::didChangeTitle(const QString& newTitle)
 void QDesktopWebViewPrivate::didChangeToolTip(const QString& newToolTip)
 {
     // FIXME: Add a proper implementation when Qt 5 supports tooltip.
-    q->canvas()->setToolTip(newToolTip);
 }
 
 void QDesktopWebViewPrivate::didChangeStatusText(const QString& newMessage)
@@ -127,7 +127,6 @@ void QDesktopWebViewPrivate::didChangeStatusText(const QString& newMessage)
 void QDesktopWebViewPrivate::didChangeCursor(const QCursor& newCursor)
 {
     // FIXME: add proper cursor handling when Qt 5 supports it.
-    q->canvas()->setCursor(newCursor);
 }
 
 void QDesktopWebViewPrivate::loadDidBegin()
@@ -164,15 +163,18 @@ void QDesktopWebViewPrivate::showContextMenu(QSharedPointer<QMenu> menu)
     if (menu->isEmpty())
         return;
 
-    QWidget* widget = q->canvas();
-    if (!widget)
+    QWindow* window = q->canvas();
+    if (!window)
         return;
 
     activeMenu = menu;
 
-    menu->setParent(widget, menu->windowFlags());
+    activeMenu->window()->winId(); // Ensure that the menu has a window
+    Q_ASSERT(activeMenu->window()->windowHandle());
+    activeMenu->window()->windowHandle()->setTransientParent(window);
+
     QPoint menuPositionInScene = q->mapToScene(menu->pos()).toPoint();
-    menu->exec(widget->mapToGlobal(menuPositionInScene));
+    menu->exec(window->mapToGlobal(menuPositionInScene));
     // The last function to get out of exec() clear the local copy.
     if (activeMenu == menu)
         activeMenu.clear();
@@ -403,8 +405,17 @@ void QDesktopWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRe
     if (!selectedFileNames.isEmpty())
         selectedFileName = selectedFileNames.at(0);
 
-    QWidget* widget = q->canvas();
-    fileDialog = new QFileDialog(widget, QString(), selectedFileName);
+    Q_ASSERT(!fileDialog);
+
+    QWindow* window = q->canvas();
+    if (!window)
+        return;
+
+    fileDialog = new QFileDialog(0, QString(), selectedFileName);
+    fileDialog->window()->winId(); // Ensure that the dialog has a window
+    Q_ASSERT(fileDialog->window()->windowHandle());
+    fileDialog->window()->windowHandle()->setTransientParent(window);
+
     fileDialog->open(this, SLOT(onOpenPanelFilesSelected()));
 
     connect(fileDialog, SIGNAL(finished(int)), this, SLOT(onOpenPanelFinished(int)));
index c1fb59f..2a854a0 100644 (file)
@@ -44,7 +44,7 @@ class QWheelEvent;
 QT_END_NAMESPACE
 
 namespace WTR {
-    class WebView;
+    class PlatformWebView;
 }
 
 class QWEBKIT_EXPORT QDesktopWebView : public QSGPaintedItem {
@@ -120,7 +120,7 @@ private:
 
     void init();
 
-    friend class WTR::WebView;
+    friend class WTR::PlatformWebView;
     friend class QDesktopWebViewPrivate;
     QDesktopWebViewPrivate *d;
 };
index 82ff76c..4dedabf 100644 (file)
@@ -11,7 +11,7 @@ SOURCES += $${TARGET}.cpp \
 INCLUDEPATH += $$PWD
 
 include(../../../../../WebKit.pri)
-QT += testlib declarative
+QT += testlib declarative widgets
 
 QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
 DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \
index f229705..04c1d92 100644 (file)
@@ -1,2 +1,3 @@
 TEMPLATE = subdirs
-SUBDIRS = qtouchwebview qdesktopwebview commonviewtests qmltests
+SUBDIRS = qtouchwebview qdesktopwebview commonviewtests
+lessThan(QT_MAJOR_VERSION, 5): SUBDIRS += qmltests
index 47e6919..161d481 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <QtCore/QSharedPointer>
 #include <QtCore/QSize>
-#include <QtGui/QMenu>
+#include <QMenu>
 #include <WebKit2/WKBase.h>
 
 class QWebError;
index dc0f206..a1b5bdd 100644 (file)
@@ -30,7 +30,7 @@
 #include "WebPopupItem.h"
 #include <QtDeclarative/QSGCanvas>
 #include <QtDeclarative/QSGItem>
-#include <QtGui/QStandardItemModel>
+#include <QStandardItemModel>
 
 using namespace WebCore;
 
@@ -44,7 +44,11 @@ WebPopupMenuProxyQtDesktop::WebPopupMenuProxyQtDesktop(WebPopupMenuProxy::Client
     , m_selectedIndex(-1)
 {
     QtWebComboBox* comboBox = m_comboBox.data();
-    comboBox->setParent(m_webViewItem->canvas());
+
+    comboBox->window()->winId(); // Ensure that the combobox has a window
+    Q_ASSERT(comboBox->window()->windowHandle());
+    comboBox->window()->windowHandle()->setTransientParent(m_webViewItem->canvas());
+
     connect(comboBox, SIGNAL(activated(int)), SLOT(setSelectedIndex(int)));
     connect(comboBox, SIGNAL(didHide()), SLOT(onPopupMenuHidden()), Qt::QueuedConnection);
 }
index 749ade5..94d83db 100644 (file)
@@ -1,3 +1,43 @@
+2011-09-23  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Fix build against Qt5 after refactor of widgets out of QtGUi
+
+        QWidget and friends now live in the QtWidgets library. We update
+        includes in implementation files and private headers to us the
+        non-module-prefixed path, and leave the lookup for the include
+        path. For public headers we have to ifdef the includes as the
+        user might now have the modules we need in his QT config.
+
+        Finally, QSGCanvas is no longer a QWidget but a QWindow, so we
+        have to update our code and use windowHandle() for setting the
+        parent relationships.
+
+        https://bugs.webkit.org/show_bug.cgi?id=68687
+
+        Reviewed by Andreas Kling.
+
+        * DumpRenderTree/qt/DumpRenderTree.pro:
+        * DumpRenderTree/qt/ImageDiff.pro:
+        * MiniBrowser/qt/BrowserView.cpp:
+        * MiniBrowser/qt/BrowserView.h:
+        * MiniBrowser/qt/BrowserWindow.cpp:
+        * MiniBrowser/qt/BrowserWindow.h:
+        * MiniBrowser/qt/MiniBrowser.pro:
+        * MiniBrowser/qt/MiniBrowserApplication.h:
+        * MiniBrowser/qt/main.cpp:
+        * QtTestBrowser/QtTestBrowser.pro:
+        * QtTestBrowser/launcherwindow.cpp:
+        * QtTestBrowser/launcherwindow.h:
+        * QtTestBrowser/locationedit.h:
+        * QtTestBrowser/main.cpp:
+        * QtTestBrowser/mainwindow.cpp:
+        * QtTestBrowser/mainwindow.h:
+        * QtTestBrowser/webinspector.h:
+        * QtTestBrowser/webpage.cpp:
+        * QtTestBrowser/webview.cpp:
+        * WebKitTestRunner/PlatformWebView.h:
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+
 2011-09-29  Ravi Phaneendra Kasibhatla  <ravi.kasibhatla@motorola.com>
 
         Initial implementation of WebInspector for WebKit2 GTK port.
index e81086a..6eabf76 100644 (file)
@@ -1,6 +1,13 @@
 TARGET = DumpRenderTree
 CONFIG  -= app_bundle
-!isEqual(QT_ARCH,sh4): CONFIG += uitools
+!isEqual(QT_ARCH,sh4) {
+    greaterThan(QT_MAJOR_VERSION, 4):isEmpty(QT.uitools.name) {
+        message("QtUiTools library not found. QWidget plugin loading will be disabled")
+        DEFINES += QT_NO_UITOOLS
+    } else {
+        CONFIG += uitools
+    }
+}
 
 BASEDIR = $$PWD/../
 isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../..
@@ -20,6 +27,7 @@ unix:!mac:!symbian:!embedded {
 
 QT = core gui network testlib
 macx: QT += xml
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
 
 HEADERS = $$BASEDIR/WorkQueue.h \
     DumpRenderTreeQt.h \
@@ -54,4 +62,4 @@ wince*: {
 DEFINES += USE_SYSTEM_MALLOC=1
 DEFINES -= QT_ASCII_CAST_WARNINGS
 
-RESOURCES = DumpRenderTree.qrc
\ No newline at end of file
+RESOURCES = DumpRenderTree.qrc
index b3d5181..92ade71 100644 (file)
@@ -7,6 +7,7 @@ INCLUDEPATH += ../../../Source/JavaScriptCore
 DESTDIR = $$OUTPUT_DIR/bin
 
 QT = core gui
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 SOURCES = ImageDiff.cpp
 
index 9313ec8..41cefc7 100644 (file)
@@ -36,7 +36,7 @@
 #include <qtouchwebpage.h>
 #include <qwebnavigationcontroller.h>
 
-BrowserView::BrowserView(bool useTouchWebView, QWidget* parent)
+BrowserView::BrowserView(bool useTouchWebView, QWindow* parent)
     : QSGCanvas(parent)
     , m_item(0)
 {
index d8dd062..5029da4 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef BrowserView_h
 #define BrowserView_h
 
+#include <QAction>
 #include <QtDeclarative/qsgcanvas.h>
 #include <qwebkittypes.h>
 
@@ -40,7 +41,7 @@ class BrowserView : public QSGCanvas {
     Q_OBJECT
 
 public:
-    BrowserView(bool useTouchWebView, QWidget* parent = 0);
+    BrowserView(bool useTouchWebView, QWindow* parent = 0);
     virtual ~BrowserView();
 
     void load(const QString&);
index bf506a7..f2f45ac 100644 (file)
@@ -42,6 +42,36 @@ static QWKPage* newPageFunction(QWKPage* page)
 }
 #endif
 
+WindowWrapper::WindowWrapper(QWindow* window, QWidget* widget)
+    : QWidget(widget)
+    , m_window(window)
+{
+    // Throttle resize events a bit
+    m_resizeTimer.setInterval(16);
+    m_resizeTimer.setSingleShot(true);
+    connect(&m_resizeTimer, SIGNAL(timeout()), this, SLOT(doResize()));
+    m_window->setWindowFlags(Qt::FramelessWindowHint);
+}
+
+void WindowWrapper::showEvent(QShowEvent* event)
+{
+    QWidget::showEvent(event);
+    m_window->setParent(window()->windowHandle());
+    m_window->show();
+}
+
+void WindowWrapper::resizeEvent(QResizeEvent* event)
+{
+    QWidget::resizeEvent(event);
+    if (!m_resizeTimer.isActive())
+        m_resizeTimer.start();
+}
+
+void WindowWrapper::doResize()
+{
+    m_window->setGeometry(QRect(mapTo(window(), QPoint(0, 0)), size()));
+}
+
 BrowserWindow::BrowserWindow(WindowOptions* options)
     : m_urlLoader(0)
     , m_browser(0)
@@ -69,8 +99,8 @@ BrowserWindow::BrowserWindow(WindowOptions* options)
         connect(desktopWebView, SIGNAL(linkHovered(QUrl, QString)), this, SLOT(onLinkHovered(QUrl, QString)));
     }
 
-    this->setCentralWidget(m_browser);
-    m_browser->setFocus(Qt::OtherFocusReason);
+    setCentralWidget(new WindowWrapper(m_browser, this));
+    centralWidget()->setFocus(Qt::OtherFocusReason);
 
     QMenu* fileMenu = menuBar()->addMenu("&File");
     fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
@@ -187,7 +217,7 @@ void BrowserWindow::onLoadProgressChanged(int progress)
 void BrowserWindow::urlChanged(const QUrl& url)
 {
     m_addressBar->setText(url.toString());
-    m_browser->setFocus();
+    m_browser->requestActivateWindow();
     m_browser->view()->setFocus(true);
 }
 
@@ -320,5 +350,4 @@ BrowserWindow::~BrowserWindow()
 {
     delete m_urlLoader;
     delete m_addressBar;
-    delete m_browser;
 }
index d69f513..2a85a00 100644 (file)
 
 #include "MiniBrowserApplication.h"
 #include <QStringList>
-#include <QtGui>
+#include <QTimer>
 
 class UrlLoader;
 
+class WindowWrapper : public QWidget
+{
+    Q_OBJECT
+
+public:
+    WindowWrapper(QWindow* window, QWidget* widget = 0);
+
+protected:
+    void showEvent(QShowEvent* event);
+    void resizeEvent(QResizeEvent* event);
+
+private slots:
+    void doResize();
+
+private:
+    QWindow* m_window;
+    QTimer m_resizeTimer;
+};
+
 class BrowserWindow : public QMainWindow {
     Q_OBJECT
 
index 3981511..c942162 100644 (file)
@@ -32,6 +32,7 @@ DESTDIR = $$OUTPUT_DIR/bin
 
 QT += network declarative
 macx:QT+=xml
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 linux-* {
     # From Creator's src/rpath.pri:
index 5697748..1fddc38 100644 (file)
 #ifndef MiniBrowserApplication_h
 #define MiniBrowserApplication_h
 
+#include <QApplication>
+#include <QFileDialog>
 #include <QHash>
+#include <QLabel>
+#include <QLineEdit>
+#include <QMainWindow>
+#include <QMenu>
+#include <QMenuBar>
+#include <QShortcut>
+#include <QStatusBar>
 #include <QStringList>
+#include <QToolBar>
 #include <QTouchEvent>
-#include <QtGui>
+#include <QUrl>
 
 struct WindowOptions {
     WindowOptions()
index 2d578d8..e90c4f7 100644 (file)
@@ -32,7 +32,6 @@
 #include "UrlLoader.h"
 #include <QLatin1String>
 #include <QRegExp>
-#include <QtGui>
 
 int main(int argc, char** argv)
 {
index 68cc8f9..5b8d6a2 100644 (file)
@@ -24,7 +24,14 @@ HEADERS += \
     fpstimer.h \
     cookiejar.h
 
-!isEqual(QT_ARCH,sh4): CONFIG += uitools
+!isEqual(QT_ARCH,sh4) {
+    greaterThan(QT_MAJOR_VERSION, 4):isEmpty(QT.uitools.name) {
+        message("QtUiTools library not found. QWidget plugin loading will be disabled")
+        DEFINES += QT_NO_UITOOLS
+    } else {
+        CONFIG += uitools
+    }
+}
 
 isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..
 include(../../Source/WebKit.pri)
@@ -35,6 +42,7 @@ DESTDIR = $$OUTPUT_DIR/bin
 
 QT += network
 macx:QT+=xml
+greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
 
 unix:!mac:!symbian:!embedded {
     CONFIG += link_pkgconfig
index 86f15fe..e1ddc5a 100644 (file)
 #include "cookiejar.h"
 #include "urlloader.h"
 
+#include <QApplication>
+#include <QCheckBox>
+#include <QComboBox>
 #include <QCoreApplication>
+#include <QDialogButtonBox>
+#include <QInputDialog>
+#include <QLabel>
+#ifndef QT_NO_LINEEDIT
+#include <QLineEdit>
+#endif
+#ifndef QT_NO_SHORTCUT
+#include <QMenuBar>
+#endif
+#include <QSlider>
+#include <QSplitter>
+#include <QStatusBar>
+#include <QToolButton>
+#include <QToolTip>
+#include <QVBoxLayout>
 
 #if !defined(QT_NO_FILEDIALOG) && !defined(QT_NO_MESSAGEBOX)
 #include <QFileDialog>
index 9a36fdf..a3255f9 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef launcherwindow_h
 #define launcherwindow_h
 
-#include <QtGui>
 #include <QtNetwork/QNetworkRequest>
 
 #if defined(QT_CONFIGURED_WITH_OPENGL)
index e8afe70..abdd9b8 100644 (file)
 #include <qconfig.h>
 
 #ifndef QT_NO_INPUTDIALOG
-#include <QtGui>
+#include <QApplication>
+#include <QIcon>
+#include <QLabel>
+#include <QLineEdit>
+#include <QStyleOptionFrameV3>
+#include <QTimer>
 
 class LocationEdit : public QLineEdit {
     Q_OBJECT
index fb42799..a9f7d13 100644 (file)
 
 WindowOptions windowOptions;
 
-
+#include <QApplication>
 #include <QDir>
 #include <QFile>
 #include <QFileInfo>
 #include <QFontDatabase>
 
-
 #if defined(Q_WS_X11)
 #include <fontconfig/fontconfig.h>
 #endif
index dcd350d..bc65fbe 100644 (file)
 #include "locationedit.h"
 #include "utils.h"
 
+#include <QAction>
+#ifndef QT_NO_INPUTDIALOG
+#include <QCompleter>
+#endif
+#ifndef QT_NO_FILEDIALOG
+#include <QFileDialog>
+#endif
+
 MainWindow::MainWindow()
     : m_page(new WebPage(this))
     , m_toolBar(0)
index f8baebc..a6a1bd2 100644 (file)
 #ifndef mainwindow_h
 #define mainwindow_h
 
-#include <QtGui>
 #include "webpage.h"
 
+#include <QMainWindow>
+#include <QStringListModel>
+#include <QToolBar>
+
 class LocationEdit;
 
 class MainWindow : public QMainWindow {
index 5cc7f8a..c24ecbf 100644 (file)
@@ -28,7 +28,6 @@
 #ifndef webinspector_h
 #define webinspector_h
 
-#include <QtGui>
 #include "qwebinspector.h"
 
 class WebInspector : public QWebInspector {
index 9088ce2..d255d06 100644 (file)
 
 #include "launcherwindow.h"
 
+#include <QAction>
+#include <QApplication>
 #include <QAuthenticator>
+#ifndef QT_NO_DESKTOPSERVICES
 #include <QDesktopServices>
-#include <QtGui>
+#endif
+#include <QDialogButtonBox>
+#include <QLabel>
+#include <QLayout>
+#ifndef QT_NO_LINEEDIT
+#include <QLineEdit>
+#endif
 #include <QtNetwork/QNetworkReply>
 #include <QtNetwork/QNetworkRequest>
 #include <QtNetwork/QNetworkProxy>
index 8e33620..3ea98f9 100644 (file)
 
 #include "webview.h"
 
-#include <QtGui>
+#include <QAction>
 #include <QGraphicsScene>
+#include <QGraphicsSceneContextMenuEvent>
+#include <QGraphicsSceneMouseEvent>
+#include <QMenu>
+#include <QScrollBar>
+#include <QTimer>
+
+#ifndef QT_NO_ANIMATION
+#include <QAbstractAnimation>
+#include <QAbstractTransition>
+#include <QFinalState>
+#include <QPropertyAnimation>
+#include <QState>
+#include <QStateMachine>
+#endif
 
 WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
     : QGraphicsView(parent)
index baf0fca..34c5a7a 100644 (file)
@@ -8,7 +8,7 @@ CONFIG(standalone_package) {
     isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = ../../../../Source/WebCore/generated
 }
 
-QT += declarative
+QT += declarative widgets
 
 GENERATED_SOURCES_DIR = ../../generated
 
index 6f412c5..5284e87 100644 (file)
 #define PlatformWebView_h
 
 #if defined(BUILDING_QT__)
-namespace WTR {
-class WebView;
-}
-typedef WTR::WebView* PlatformWKView;
-class QMainWindow;
-typedef QMainWindow* PlatformWindow;
+class QDesktopWebView;
+typedef QDesktopWebView* PlatformWKView;
+class QSGCanvas;
+typedef QSGCanvas* PlatformWindow;
 #elif defined(__APPLE__) && __APPLE__
 #if __OBJC__
 @class WKView;
index fe22080..09d40c6 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "PlatformWebView.h"
 #include "TestController.h"
+#include <QGraphicsSceneMouseEvent>
 #include <QKeyEvent>
 #include <QtTest/QtTest>
 #include <WebKit2/WKPagePrivate.h>
index 81ae9d2..f1e0b69 100644 (file)
 
 #include "PlatformWebView.h"
 #include "qdesktopwebview.h"
+
+#include <QApplication>
 #include <QtDeclarative/qsgcanvas.h>
-#include <QtGui>
 
 namespace WTR {
 
-class WebView : public QSGCanvas {
-public:
-    WebView(WKContextRef, WKPageGroupRef);
-
-    QDesktopWebView* wkView() const { return m_item; }
-    WKPageRef pageRef() const { return m_item->pageRef(); }
-
-    virtual ~WebView() { delete m_item; }
-
-private:
-    QDesktopWebView* m_item;
-};
-
-WebView::WebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
-    : m_item(new QDesktopWebView(contextRef, pageGroupRef, rootItem()))
-{
-    m_item->setWidth(800);
-    m_item->setHeight(600);
-}
-
 PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
-    : m_view(new WebView(contextRef, pageGroupRef))
-    , m_window(new QMainWindow())
+    : m_view(new QDesktopWebView(contextRef, pageGroupRef))
+    , m_window(new QSGCanvas)
 {
-    m_view->setParent(m_window);
-    m_window->setCentralWidget(m_view);
+    m_view->setParent(m_window->rootItem());
     m_window->setGeometry(0, 0, 800, 600);
 
     QFocusEvent ev(QEvent::WindowActivate);
     QApplication::sendEvent(m_view, &ev);
-    m_view->wkView()->setFocus(Qt::OtherFocusReason);
+    m_view->setFocus(Qt::OtherFocusReason);
 }
 
 PlatformWebView::~PlatformWebView()
@@ -104,12 +84,12 @@ void PlatformWebView::setWindowFrame(WKRect wkRect)
 
 bool PlatformWebView::sendEvent(QEvent* event)
 {
-    return QCoreApplication::sendEvent(m_view->wkView(), event);
+    return QCoreApplication::sendEvent(m_view, event);
 }
 
 void PlatformWebView::postEvent(QEvent* event)
 {
-    QCoreApplication::postEvent(m_view->wkView(), event);
+    QCoreApplication::postEvent(m_view, event);
 }
 
 } // namespace WTR
index c5ad1a8..09d7d2e 100644 (file)
@@ -31,7 +31,7 @@ unix:!mac:!symbian:!embedded {
     PKGCONFIG += fontconfig
 }
 
-QT = core gui network declarative testlib
+QT = core gui widgets network declarative testlib
 
 HEADERS = \
     $$BASEDIR/EventSenderProxy.h \
@@ -68,4 +68,4 @@ linux-* {
 include(../../../Source/JavaScriptCore/JavaScriptCore.pri)
 prependJavaScriptCoreLib(../../JavaScriptCore)
 
-RESOURCES = WebKitTestRunner.qrc
\ No newline at end of file
+RESOURCES = WebKitTestRunner.qrc