+2012-02-21 Andras Becsi <andras.becsi@nokia.com>
+
+ [Qt][WK2] Get rid of the dependency to QtWidgets
+ https://bugs.webkit.org/show_bug.cgi?id=76276
+
+ Reviewed by Simon Hausmann.
+
+ * MiniBrowser/qt/MiniBrowser.pro:
+ * MiniBrowser/qt/MiniBrowserApplication.cpp:
+ (MiniBrowserApplication::MiniBrowserApplication):
+ (MiniBrowserApplication::notify):
+ (MiniBrowserApplication::sendTouchEvent):
+ * MiniBrowser/qt/MiniBrowserApplication.h:
+ (MiniBrowserApplication):
+ * QtTestBrowser/locationedit.h:
+ * WebKitTestRunner/InjectedBundle/qt/ActivateFontsQt.cpp:
+ (WTR::activateFonts):
+ * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+
2012-02-20 Adam Barth <abarth@webkit.org>
mastercfg_unittest.py fails without simplejson
#include <QEvent>
#include <QMouseEvent>
#include <QTouchEvent>
-#include <QApplication>
static inline bool isTouchEvent(const QEvent* event)
{
}
MiniBrowserApplication::MiniBrowserApplication(int& argc, char** argv)
- : QApplication(argc, argv)
+ : QGuiApplication(argc, argv)
, m_realTouchEventReceived(false)
, m_pendingFakeTouchEventCount(0)
, m_isRobotized(false)
, m_robotTimeoutSeconds(0)
, m_robotExtraTimeSeconds(0)
, m_windowOptions(this)
+ , m_holdingControl(false)
{
setOrganizationName("Nokia");
setApplicationName("QtMiniBrowser");
bool MiniBrowserApplication::notify(QObject* target, QEvent* event)
{
+ if(QInputEvent* ie = static_cast<QInputEvent*>(event))
+ m_holdingControl = ie->modifiers().testFlag(Qt::ControlModifier);
+ else
+ m_holdingControl = false;
+
// We try to be smart, if we received real touch event, we are probably on a device
// with touch screen, and we should not have touch mocking.
if (!event->spontaneous() || m_realTouchEventReceived || !m_windowOptions.touchMockingEnabled())
- return QApplication::notify(target, event);
+ return QGuiApplication::notify(target, event);
if (isTouchEvent(event) && static_cast<QTouchEvent*>(event)->deviceType() == QTouchEvent::TouchScreen) {
if (m_pendingFakeTouchEventCount)
--m_pendingFakeTouchEventCount;
else
m_realTouchEventReceived = true;
- return QApplication::notify(target, event);
+ return QGuiApplication::notify(target, event);
}
BrowserWindow* browserWindow = qobject_cast<BrowserWindow*>(target);
if (!browserWindow)
- return QApplication::notify(target, event);
+ return QGuiApplication::notify(target, event);
// In QML events are propagated through parents. But since the WebView
// may consume key events, a shortcut might never reach the top QQuickItem.
break;
case QEvent::MouseMove:
if (!mouseEvent->buttons() || !m_touchPoints.contains(mouseEvent->buttons()))
- return QApplication::notify(target, event);
+ return QGuiApplication::notify(target, event);
touchPoint.id = mouseEvent->buttons();
touchPoint.state = Qt::TouchPointMoved;
break;
case QEvent::MouseButtonRelease:
touchPoint.state = Qt::TouchPointReleased;
touchPoint.id = mouseEvent->button();
- if (mouseEvent->modifiers().testFlag(Qt::ControlModifier)) {
+ if (m_holdingControl) {
m_heldTouchPoints.insert(touchPoint.id);
- return QApplication::notify(target, event);
+ return QGuiApplication::notify(target, event);
}
break;
default:
sendTouchEvent(browserWindow);
}
- return QApplication::notify(target, event);
+ return QGuiApplication::notify(target, event);
}
void MiniBrowserApplication::sendTouchEvent(BrowserWindow* browserWindow)
m_pendingFakeTouchEventCount++;
QWindowSystemInterface::handleTouchEvent(browserWindow, device, m_touchPoints.values());
- bool holdingControl = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
if (QQuickWebViewExperimental::flickableViewportEnabled())
- browserWindow->updateVisualMockTouchPoints(holdingControl ? m_touchPoints.values() : QList<QWindowSystemInterface::TouchPoint>());
+ browserWindow->updateVisualMockTouchPoints(m_holdingControl ? m_touchPoints.values() : QList<QWindowSystemInterface::TouchPoint>());
// Get rid of touch-points that are no longer valid
foreach (const QWindowSystemInterface::TouchPoint& touchPoint, m_touchPoints) {
- if (touchPoint.state == Qt::TouchPointReleased)
- m_touchPoints.remove(touchPoint.id);
+ if (touchPoint.state == Qt::TouchPointReleased)
+ m_touchPoints.remove(touchPoint.id);
}
}