, hasCanvasWindow(false)
, available(false)
, renderTarget(QQuickCanvasItem::Image)
- , renderStrategy(QQuickCanvasItem::Cooperative)
+ , renderStrategy(QQuickCanvasItem::Immediate)
{
- antialiasing = true;
+ implicitAntialiasing = true;
}
QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
}
}
query->accept();
- return true;
- } else if (ev->type() == QEvent::InputMethod) {
+ break;
+ }
+ case QEvent::InputMethod:
inputMethodEvent(static_cast<QInputMethodEvent *>(ev));
- return true;
- } else
+ break;
#endif // QT_NO_IM
- if (ev->type() == QEvent::StyleAnimationUpdate) {
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ case QEvent::TouchCancel:
+ touchEvent(static_cast<QTouchEvent*>(ev));
+ break;
+ case QEvent::StyleAnimationUpdate:
- update();
+ if (isVisible()) {
+ ev->accept();
+ update();
+ }
- return true;
+ break;
+ case QEvent::HoverEnter:
+ hoverEnterEvent(static_cast<QHoverEvent*>(ev));
+ break;
+ case QEvent::HoverLeave:
+ hoverLeaveEvent(static_cast<QHoverEvent*>(ev));
+ break;
+ case QEvent::HoverMove:
+ hoverMoveEvent(static_cast<QHoverEvent*>(ev));
+ break;
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ d->deliverKeyEvent(static_cast<QKeyEvent*>(ev));
+ break;
+ case QEvent::FocusIn:
+ focusInEvent(static_cast<QFocusEvent*>(ev));
+ break;
+ case QEvent::FocusOut:
+ focusOutEvent(static_cast<QFocusEvent*>(ev));
+ break;
+ case QEvent::MouseMove:
+ mouseMoveEvent(static_cast<QMouseEvent*>(ev));
+ break;
+ case QEvent::MouseButtonPress:
+ mousePressEvent(static_cast<QMouseEvent*>(ev));
+ break;
+ case QEvent::MouseButtonRelease:
+ mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
+ break;
+ case QEvent::MouseButtonDblClick:
+ mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
+ break;
+#ifndef QT_NO_WHEELEVENT
+ case QEvent::Wheel:
+ wheelEvent(static_cast<QWheelEvent*>(ev));
+ break;
+#endif
+#ifndef QT_NO_DRAGANDDROP
+ case QEvent::DragEnter:
+ dragEnterEvent(static_cast<QDragEnterEvent*>(ev));
+ break;
+ case QEvent::DragLeave:
+ dragLeaveEvent(static_cast<QDragLeaveEvent*>(ev));
+ break;
+ case QEvent::DragMove:
+ dragMoveEvent(static_cast<QDragMoveEvent*>(ev));
+ break;
+ case QEvent::Drop:
+ dropEvent(static_cast<QDropEvent*>(ev));
+ break;
+#endif // QT_NO_DRAGANDDROP
+ default:
+ return QObject::event(ev);
}
- return QObject::event(ev);
+
+ return true;
}
#ifndef QT_NO_DEBUG_STREAM
return implicitHeight;
}
- /*!
- \qmlproperty enumeration QtQuick::Text::renderType
-
- Override the default rendering type for this component.
-
- Supported render types are:
- \list
- \li Text.QtRendering - the default
- \li Text.NativeRendering
- \endlist
-
- Select Text.NativeRendering if you prefer text to look native on the target platform and do
- not require advanced features such as transformation of the text. Using such features in
- combination with the NativeRendering render type will lend poor and sometimes pixelated
- results.
-
- On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored
- and QtRendering is always used.
- */
- QQuickText::RenderType QQuickText::renderType() const
- {
- Q_D(const QQuickText);
- return d->renderType;
- }
-
- void QQuickText::setRenderType(QQuickText::RenderType renderType)
- {
- Q_D(QQuickText);
- if (d->renderType == renderType)
- return;
-
- d->renderType = renderType;
- emit renderTypeChanged();
-
- if (isComponentComplete())
- d->updateLayout();
- }
-
+/*!
+ \qmlproperty bool QtQuick::Text::antialiasing
+
+ Used to decide if the Text should use antialiasing or not. Only Text
+ with renderType of Text.NativeRendering can disable antialiasing.
+
+ The default is true.
+*/
+
void QQuickText::q_imagesLoaded()
{
Q_D(QQuickText);
void testProxyModelChangedAfterMove();
void typedModel();
+ void displayMargin();
+ void highlightItemGeometryChanges();
+
private:
template <class T> void items(const QUrl &source);
template <class T> void changed(const QUrl &source);
QCOMPARE(listview->count(), 0);
}
+void tst_QQuickListView::displayMargin()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("displayMargin.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
+ QVERIFY(listview != 0);
+
+ QQuickItem *content = listview->contentItem();
+ QVERIFY(content != 0);
+
+ QQuickItem *item0;
+ QQuickItem *item14;
+
+ QVERIFY(item0 = findItem<QQuickItem>(content, "delegate", 0));
+ QCOMPARE(delegateVisible(item0), true);
+
+ // the 14th item should be within the end margin
+ QVERIFY(item14 = findItem<QQuickItem>(content, "delegate", 13));
+ QCOMPARE(delegateVisible(item14), true);
+
+ // the 15th item should be outside the end margin
+ QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == 0);
+
+ // the first delegate should still be within the begin margin
+ listview->positionViewAtIndex(3, QQuickListView::Beginning);
+ QCOMPARE(delegateVisible(item0), true);
+
+ // the first delegate should now be outside the begin margin
+ listview->positionViewAtIndex(4, QQuickListView::Beginning);
+ QCOMPARE(delegateVisible(item0), false);
+
+ delete window;
+}
+
+ void tst_QQuickListView::highlightItemGeometryChanges()
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("HighlightResize.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickListView *listview = qobject_cast<QQuickListView *>(object.data());
+ QVERIFY(listview);
+
+ QCOMPARE(listview->count(), 5);
+
+ for (int i = 0; i < listview->count(); ++i) {
+ listview->setCurrentIndex(i);
+ QTRY_COMPARE(listview->highlightItem()->width(), qreal(100 + i * 20));
+ QTRY_COMPARE(listview->highlightItem()->height(), qreal(100 + i * 10));
+ }
+ }
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"