aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-08-16 17:58:27 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-09-29 16:14:44 +0200
commite57ba6916efec2a9506b5b12ed34e402c48955d1 (patch)
treee135ed41875a968739b459b0db7f9abe964534c7 /examples
parent6a50f9350d8abf65e23c65daef76b862097ec7e8 (diff)
Large Text: populate only lines visible in Window into SG
Text is rendered top-to-bottom: QQuickTextNode::addTextLayout() iterates lines of text. Now it first maps the window size() rectangle into the Text item's coordinate system, and treats that as the viewport: lines whose y coordinates fall outside are omitted. This saves a huge amount of time and memory when the text is large. So Flickable { Text { } } can actually be used in an ebook reader now, for example. QQuickItemPrivate::transformChanged(parent) is now used to inform all children when a parent moves; so e.g. when a content item is moved inside a "viewport" item (like a Flickable, or any other item that is being used as a clipping viewport or just as a holder), all children of the content item will be notified; and QQuickTextPrivate uses this occasion to mark itself dirty so that the updatePaintNode() will be called again. This happens directly after the actual movement: QQuickTextPrivate::transformChanged qquicktext.cpp 2990 QQuickItemPrivate::transformChanged qquickitem.cpp 5200 QQuickItemPrivate::dirty qquickitem.cpp 6339 QQuickItem::setY qquickitem.cpp 6830 QQuickFlickablePrivate::setViewportY qquickflickable.cpp 1800 Task-number: QTBUG-60491 Task-number: QTBUG-90734 Change-Id: I152d23caa725f194a186a604fbc8d0c07f597b16 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/pointerhandlers/fakeFlickable.qml28
1 files changed, 22 insertions, 6 deletions
diff --git a/examples/quick/pointerhandlers/fakeFlickable.qml b/examples/quick/pointerhandlers/fakeFlickable.qml
index b6be729e3c..2234a7793a 100644
--- a/examples/quick/pointerhandlers/fakeFlickable.qml
+++ b/examples/quick/pointerhandlers/fakeFlickable.qml
@@ -120,15 +120,31 @@ Rectangle {
}
LeftDrawer {
- width: 100
+ width: buttonRow.implicitWidth + 20
anchors.verticalCenter: parent.verticalCenter
- Slider {
- id: slider
- label: "font\nsize"
+ Column {
anchors.fill: parent
anchors.margins: 10
- maximumValue: 36
- value: 14
+ Slider {
+ id: slider
+ width: parent.width
+ height: parent.height - buttonRow.implicitHeight
+ label: "font\nsize"
+ maximumValue: 36
+ value: 14
+ }
+ Row {
+ id: buttonRow
+ spacing: 4
+ TapHandlerButton {
+ text: "⭯"
+ onClicked: ff.rotation -= 45
+ }
+ TapHandlerButton {
+ text: "⭮"
+ onClicked: ff.rotation += 45
+ }
+ }
}
}
}