RESOLVED FIXED 74074
[Qt] Visualize mock points in the Qt MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=74074
Summary [Qt] Visualize mock points in the Qt MiniBrowser
Alexander Færøy
Reported 2011-12-08 04:33:21 PST
SSIA.
Attachments
Patch (9.36 KB, patch)
2011-12-08 04:46 PST, Alexander Færøy
no flags
Patch (9.20 KB, patch)
2011-12-08 06:39 PST, Alexander Færøy
no flags
Patch (9.12 KB, patch)
2011-12-08 06:58 PST, Alexander Færøy
no flags
Patch (10.97 KB, patch)
2011-12-08 08:13 PST, Alexander Færøy
no flags
Patch (10.94 KB, patch)
2011-12-08 09:17 PST, Alexander Færøy
no flags
Alexander Færøy
Comment 1 2011-12-08 04:46:42 PST
Kenneth Rohde Christiansen
Comment 2 2011-12-08 05:02:39 PST
Comment on attachment 118363 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118363&action=review > Tools/ChangeLog:16 > + * MiniBrowser/qt/qml/TouchMockPoint.qml: Copied from Tools/MiniBrowser/qt/BrowserWindow.h. Pretty stupid comment :-) pls remove and add Added > Tools/MiniBrowser/qt/BrowserWindow.cpp:88 > + QHash<int, QQuickItem*>::iterator iter = m_touchMockPoints.find(id); we normally use the name "it" in webkit > Tools/MiniBrowser/qt/BrowserWindow.cpp:99 > + > + iter.value()->setX(position.x() / 2); > + iter.value()->setY(position.y() / 2); > + iter.value()->setOpacity(opacity); why not (*it)->set... > Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:174 > + // Get rid of touch-points that are no longer valid + . at the end :-) > Tools/MiniBrowser/qt/qml/TouchMockPoint.qml:31 > + visible: true isn't that default?
Tor Arne Vestbø
Comment 3 2011-12-08 05:21:20 PST
Comment on attachment 118363 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118363&action=review > Tools/MiniBrowser/qt/BrowserWindow.cpp:86 > +void BrowserWindow::updateTouchMockPoint(int id, const QPointF& position, qreal opacity) updateMockTouchPoints >> Tools/MiniBrowser/qt/BrowserWindow.cpp:88 >> + QHash<int, QQuickItem*>::iterator iter = m_touchMockPoints.find(id); > > we normally use the name "it" in webkit Look up old touch points that you can re-use from the engine based on the id, instead of keeping a list. > Tools/MiniBrowser/qt/BrowserWindow.cpp:97 > + iter.value()->setX(position.x() / 2); set the x and y, and do the offsetting to center it in the qml >> Tools/MiniBrowser/qt/BrowserWindow.cpp:99 >> + iter.value()->setOpacity(opacity); > > why not (*it)->set... i'd rather see a "pressed" property that you set and unset based on the point being released or not, and you can then deal with how you hide it in the qml > Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:163 > + do we ever have a situation without a browser window? > Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:168 > + qreal opacity = 1.0; see comment about "pressed". we should not deal with opacity here, that's an implementation detail of the visual component
Tor Arne Vestbø
Comment 4 2011-12-08 05:22:17 PST
(In reply to comment #3) > (From update of attachment 118363 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=118363&action=review > > > Tools/MiniBrowser/qt/BrowserWindow.cpp:86 > > +void BrowserWindow::updateTouchMockPoint(int id, const QPointF& position, qreal opacity) > > updateMockTouchPoints Or, updateVisualMockTouchPoints
Alexander Færøy
Comment 5 2011-12-08 06:39:52 PST
Alexander Færøy
Comment 6 2011-12-08 06:58:25 PST
Tor Arne Vestbø
Comment 7 2011-12-08 07:19:16 PST
Comment on attachment 118383 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118383&action=review > Tools/MiniBrowser/qt/BrowserWindow.cpp:107 > + foreach (QQuickItem* item, rootObject()->childItems()) { > + QVariant itemId = item->property("id"); > + > + if (itemId.toString() == mockTouchPointIdentifier) { > + mockTouchPointItem = item; > + break; > + } > + } Set the objectName instead of the id, and use rootObject()->findChild<QQuickItem*>(mockTouchPointIdentifier); > Tools/MiniBrowser/qt/BrowserWindow.cpp:118 > + mockTouchPointItem->setProperty("pressed", QVariant(pressed)); replace the pressed variable with touchPoint.state == Qt::TouchPointReleased > Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:166 > + BrowserWindow* browserWindow = dynamic_cast<BrowserWindow*>(targetWindow); > + > + if (browserWindow) > + browserWindow->updateVisualMockTouchPoints(m_touchPoints.values()); > + if (BrowserWindow* browserWindow = qobject_cast<BrowserWindow*>(targetWindow)) browserWindow->updateVisualMockTouchPoints(m_touchPoints.values());
Alexander Færøy
Comment 8 2011-12-08 08:13:15 PST
Tor Arne Vestbø
Comment 9 2011-12-08 09:11:12 PST
Comment on attachment 118393 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118393&action=review > Tools/MiniBrowser/qt/BrowserWindow.cpp:92 > + bool pressed = touchPoint.state != Qt::TouchPointReleased; > + QPointF position = touchPoint.area.topLeft(); > + position.rx() -= geometry().x(); > + position.ry() -= geometry().y(); Move this down to where you set it, and remove the pressed-variable, you can set the property directly based on touchPoint.state != Qt::TouchPointReleased
Alexander Færøy
Comment 10 2011-12-08 09:17:28 PST
Tor Arne Vestbø
Comment 11 2011-12-08 09:24:28 PST
Comment on attachment 118403 [details] Patch great!
WebKit Review Bot
Comment 12 2011-12-08 10:39:09 PST
Comment on attachment 118403 [details] Patch Clearing flags on attachment: 118403 Committed r102348: <http://trac.webkit.org/changeset/102348>
WebKit Review Bot
Comment 13 2011-12-08 10:39:14 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.