Title: [144758] trunk/Tools
- Revision
- 144758
- Author
- [email protected]
- Date
- 2013-03-05 07:00:00 -0800 (Tue, 05 Mar 2013)
Log Message
[Qt][MiniBrowser] Improve the update of touch indicators
https://bugs.webkit.org/show_bug.cgi?id=111429
Reviewed by Jocelyn Turcotte.
MiniBrowserApplication::sendTouchEvent sends an empty list
to BrowserWindow::updateVisualMockTouchPoints if the control
button is released, in which case the touch indicators should
be hidden so that we never end up with a leftover indicator
sticking on the screen.
This patch also simplifies the lookup of the indicator items by
replacing the findChild search in the item tree with a QHash
that stores the touch ID's and the pointers to the corresponding
indicator items.
* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::updateVisualMockTouchPoints):
* MiniBrowser/qt/BrowserWindow.h:
(BrowserWindow):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (144757 => 144758)
--- trunk/Tools/ChangeLog 2013-03-05 14:54:08 UTC (rev 144757)
+++ trunk/Tools/ChangeLog 2013-03-05 15:00:00 UTC (rev 144758)
@@ -1,3 +1,25 @@
+2013-03-05 Andras Becsi <[email protected]>
+
+ [Qt][MiniBrowser] Improve the update of touch indicators
+ https://bugs.webkit.org/show_bug.cgi?id=111429
+
+ Reviewed by Jocelyn Turcotte.
+
+ MiniBrowserApplication::sendTouchEvent sends an empty list
+ to BrowserWindow::updateVisualMockTouchPoints if the control
+ button is released, in which case the touch indicators should
+ be hidden so that we never end up with a leftover indicator
+ sticking on the screen.
+ This patch also simplifies the lookup of the indicator items by
+ replacing the findChild search in the item tree with a QHash
+ that stores the touch ID's and the pointers to the corresponding
+ indicator items.
+
+ * MiniBrowser/qt/BrowserWindow.cpp:
+ (BrowserWindow::updateVisualMockTouchPoints):
+ * MiniBrowser/qt/BrowserWindow.h:
+ (BrowserWindow):
+
2013-03-05 Tim Horton <[email protected]>, Grzegorz Czajkowski <[email protected]>
[WK2] WTR needs an implementation of setAsynchronousSpellCheckingEnabled
Modified: trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp (144757 => 144758)
--- trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp 2013-03-05 14:54:08 UTC (rev 144757)
+++ trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp 2013-03-05 15:00:00 UTC (rev 144758)
@@ -118,14 +118,22 @@
void BrowserWindow::updateVisualMockTouchPoints(const QList<QTouchEvent::TouchPoint>& touchPoints)
{
+ if (touchPoints.isEmpty()) {
+ // Hide all touch indicator items.
+ foreach (QQuickItem* item, m_activeMockComponents.values())
+ item->setProperty("pressed", false);
+
+ return;
+ }
+
foreach (const QTouchEvent::TouchPoint& touchPoint, touchPoints) {
- QString mockTouchPointIdentifier = QString("mockTouchPoint%1").arg(touchPoint.id());
- QQuickItem* mockTouchPointItem = rootObject()->findChild<QQuickItem*>(mockTouchPointIdentifier, Qt::FindDirectChildrenOnly);
+ QQuickItem* mockTouchPointItem = m_activeMockComponents.value(touchPoint.id());
if (!mockTouchPointItem) {
QQmlComponent touchMockPointComponent(engine(), QUrl("qrc:///qml/MockTouchPoint.qml"));
mockTouchPointItem = qobject_cast<QQuickItem*>(touchMockPointComponent.create());
- mockTouchPointItem->setObjectName(mockTouchPointIdentifier);
+ Q_ASSERT(mockTouchPointItem);
+ m_activeMockComponents.insert(touchPoint.id(), mockTouchPointItem);
mockTouchPointItem->setProperty("pointId", QVariant(touchPoint.id()));
mockTouchPointItem->setParent(rootObject());
mockTouchPointItem->setParentItem(rootObject());
Modified: trunk/Tools/MiniBrowser/qt/BrowserWindow.h (144757 => 144758)
--- trunk/Tools/MiniBrowser/qt/BrowserWindow.h 2013-03-05 14:54:08 UTC (rev 144757)
+++ trunk/Tools/MiniBrowser/qt/BrowserWindow.h 2013-03-05 15:00:00 UTC (rev 144758)
@@ -68,6 +68,7 @@
virtual void wheelEvent(QWheelEvent*);
WindowOptions* m_windowOptions;
+ QHash<int, QQuickItem*> m_activeMockComponents;
QVector<qreal> m_zoomLevels;
unsigned m_currentZoomLevel;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes