We have moved to a new Sailfish OS Forum. Please start new discussions there.

Should VerticalScrollDecorator work with SilicaFlickable? [answered]

asked 2014-04-14 21:52:40 +0300

ISU gravatar image

updated 2014-04-15 10:47:45 +0300

I am having trouble with adding VerticalScrollDecorator to a SilicaFlickable page containing large amount of words in a column in a label.

Should this code example produce vertical scroll decorator when the text goes out of screen? Have I misunderstood some basic positioning rules or does the text wrapping confuse vertical scroll decorator somehow?

import QtQuick 2.0

import Sailfish.Silica 1.0

Page {

id: helpPage
SilicaFlickable {
    id: help
    anchors.fill: parent;
    VerticalScrollDecorator { flickable: help }

    Column {
        width: parent.width
        PageHeader {
            title: qsTr("Help and user guide")
        Label {               
            x: Theme.paddingMedium
            width: parent.width-2*Theme.paddingMedium;
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
            textFormat: Text.RichText; 
            text: qsTr("Many rows of text...") +'<br/>'+
                  qsTr("Row 2")+'<br/>'+
                  qsTr("Row 3")
edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by Spam Hunter
close date 2020-04-15 13:28:46.255153

1 Answer

Sort by » oldest newest most voted

answered 2014-04-15 10:44:23 +0300

For the flickable to work, you need to distinguish the flickable size itself from its content size. So, in your example, since you're interested in vertical flick, you should provide a contentHeight attribute.

  • give a name to your column (which calculates its total height for you), let's say id: content
  • provide the contentHeight attribute to your flickable, refering to the column height : contentHeight: content.height

Then, it'll work.

To avoid undesired flicking, by default, contentWidth and contentHeight are binded to width and heght respectively (of the flickable), so there is no horizontal flick or vertical one allowed. You need to specify a contentWidth or Height attribute to activate flicking in a given direction or both.

edit flag offensive delete publish link more



Thank you very much! I am pretty sure it would have taken me days to figure that out.

ISU ( 2014-04-15 18:02:24 +0300 )edit

Thank you for this answer. It was not at all clear from the docs! Maybe it's obvious to people who have used QtQuick before.

Feathers_McGraw ( 2016-01-08 22:26:55 +0300 )edit

Question tools

1 follower


Asked: 2014-04-14 21:52:40 +0300

Seen: 359 times

Last updated: Apr 15 '14