qt - how to create a scrollbar for rectangle in QML -


like web pages,when content's high beyond rectangle,there scrollbar. there else can me? have tried listview,but can't use in rectangle

there example in latest documentation snapshots of qt quick controls 2, how use scrollbar without flickable:

enter image description here

import qtquick 2.7 import qtquick.controls 2.0  rectangle {     id: frame     clip: true     width: 160     height: 160     border.color: "black"     anchors.centerin: parent      text {         id: content         text: "abc"         font.pixelsize: 160         x: -hbar.position * width         y: -vbar.position * height     }      scrollbar {         id: vbar         hoverenabled: true         active: hovered || pressed         orientation: qt.vertical         size: frame.height / content.height         anchors.top: parent.top         anchors.right: parent.right         anchors.bottom: parent.bottom     }      scrollbar {         id: hbar         hoverenabled: true         active: hovered || pressed         orientation: qt.horizontal         size: frame.width / content.width         anchors.left: parent.left         anchors.right: parent.right         anchors.bottom: parent.bottom     } } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -