Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Tumbler horizontally align visible items separately
Forum Updated to NodeBB v4.3 + New Features

QML Tumbler horizontally align visible items separately

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
tumbler styletumblerqt5.5
1 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TomsBrookT Offline
    TomsBrookT Offline
    TomsBrook
    wrote on last edited by
    #1

    Hi I am using a QML Tumbler item with Qt5.5 and have a tumbler showing three visible elements and am trying to have the delegate above the current item aligned to the top of the tumbler and the delegate below the current item to align to the bottom - just to set some space between the three elements and fill the tumbler.

    TumblerStyle{
                id: tumblerStyle
                visibleItemCount: 3
                background: Item{
                    id: background_tmblr
                    visible: false
                }
    
                foreground: Item{
                    id: foreground_tmblr
                    visible: false
                }
    
                delegate: Item {
                    id: delegate_style
                    implicitHeight: (parent.height - padding.top - padding.bottom) / tumblerStyle.visibleItemCount
                    implicitWidth: (parent.width - padding.top - padding.bottom)
                    Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
                    anchors.centerIn: parent
                    Item{
                        ColumnLayout {
                            id: metadata_tmbler
                            anchors.fill: parent
                            spacing: 10
                            Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
    
                            Text {
                                verticalAlignment: styleData.current? Text.AlignVCenter : styleData.displacement > 0? Text.AlignBottom : Text.AlignTop
                                horizontalAlignment: Text.AlignHCenter
                                Layout.preferredWidth: 300
                                Layout.preferredHeight: 40
                            }//Text
                        }//Column Layout
                    }//item
                }//delegate Item
    

    but I can't seem to get the vertical alignment to accurately show this.
    Top Item - aligned to top of tumbler
    Middle Item - aligned to center of tumbler
    Bottom Item - aligned to bottom of tumbler

    Thanks

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved