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. Flickable in Drawer
QtWS25 Last Chance

Flickable in Drawer

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 1.7k Views
  • 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.
  • A Offline
    A Offline
    Amir Afendin
    wrote on last edited by
    #1

    Is it possible to use Fliackable in Drawer ? I tried different ways but it didn't work.
    For instance:

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Controls.Material 2.0
    
    Drawer {
    id: drawer
    width: Math.min(window.width, window.height) / 3 * 2
    height:  window.height
    
    Flickable {
        contentHeight: drawer.height
        Column {
            Repeater {
                model: 150
                Text {
                    text: "OMG"
                }
            }
        }
    }
    }
    
    1 Reply Last reply
    0
    • Julien BJ Offline
      Julien BJ Offline
      Julien B
      wrote on last edited by
      #2

      Hello @Amir-Afendin,

      It is possible to use a Flickable in Drawer.

      
      Drawer {
          id: drawer
          width: Math.min(window.width, window.height) / 3 * 2
          height:  window.height
      
          ListView {
              id: listview
              width: parent.width; height: parent.height
              // When scroll end align to the nearest item
              snapMode: ListView.SnapToItem
              // Clip painting to his own bounding rectangle to avoid display
              // data outside specified size during flick
              clip: true
      
              model: listModel
      
              // Display Scroll bar only when moving
              onMovementStarted: verticalScrollBar.opacity = 1
              onMovementEnded: verticalScrollBar.opacity = 0
      
              // Auto fade Scrollbar
              ScrollBar.vertical: ScrollBar {
                  id: verticalScrollBar
                  active: true
                  orientation: Qt.Vertical
      
                  opacity: 0
                  Behavior on opacity {NumberAnimation { duration: 500 }}
      
                  contentItem: Rectangle {
                      implicitWidth: 4
                      radius:2
                      implicitHeight: 100
                      color: "grey"
                  }
              }
      
              delegate: Component {
                  id: myDelegate
                  Text {
                      text: name
                      color: "white"
                  }
      
              }
      
              ListModel {
                  id: listModel
                  ListElement { name: "One"}
                  ListElement { name: "Two"}
                  ListElement { name: "Three"}
                  ListElement { name: "Four"}
              }
          }
      }
      

      Nevertheless i am not sure you can use a Repeater to create your model.

      Have you tried to create it from C++?

      A 1 Reply Last reply
      0
      • Julien BJ Julien B

        Hello @Amir-Afendin,

        It is possible to use a Flickable in Drawer.

        
        Drawer {
            id: drawer
            width: Math.min(window.width, window.height) / 3 * 2
            height:  window.height
        
            ListView {
                id: listview
                width: parent.width; height: parent.height
                // When scroll end align to the nearest item
                snapMode: ListView.SnapToItem
                // Clip painting to his own bounding rectangle to avoid display
                // data outside specified size during flick
                clip: true
        
                model: listModel
        
                // Display Scroll bar only when moving
                onMovementStarted: verticalScrollBar.opacity = 1
                onMovementEnded: verticalScrollBar.opacity = 0
        
                // Auto fade Scrollbar
                ScrollBar.vertical: ScrollBar {
                    id: verticalScrollBar
                    active: true
                    orientation: Qt.Vertical
        
                    opacity: 0
                    Behavior on opacity {NumberAnimation { duration: 500 }}
        
                    contentItem: Rectangle {
                        implicitWidth: 4
                        radius:2
                        implicitHeight: 100
                        color: "grey"
                    }
                }
        
                delegate: Component {
                    id: myDelegate
                    Text {
                        text: name
                        color: "white"
                    }
        
                }
        
                ListModel {
                    id: listModel
                    ListElement { name: "One"}
                    ListElement { name: "Two"}
                    ListElement { name: "Three"}
                    ListElement { name: "Four"}
                }
            }
        }
        

        Nevertheless i am not sure you can use a Repeater to create your model.

        Have you tried to create it from C++?

        A Offline
        A Offline
        Amir Afendin
        wrote on last edited by
        #3

        @Julien-B Thanks for the efforts, but I need exactly Flickable not ListView. I need scrolling page because I'm going to put different items there and it's gonna be tough with ListView because of Loader and different stuff, for now i'm just seeking for simple solution. For example do you have aliexpress application? I need Drawer like that.

        1 Reply Last reply
        0
        • Julien BJ Offline
          Julien BJ Offline
          Julien B
          wrote on last edited by
          #4

          Is something like that close to what you are looking for?

          Flickable {
          
              anchors.fill: parent
              contentHeight: contentItem.childrenRect.height
          
              Column {
                  Repeater {
                      model: 150
                      Text {
                          text: "OMG"
                          color: "white"
                      }
                  }
              }
          }
          
          A 1 Reply Last reply
          0
          • Julien BJ Julien B

            Is something like that close to what you are looking for?

            Flickable {
            
                anchors.fill: parent
                contentHeight: contentItem.childrenRect.height
            
                Column {
                    Repeater {
                        model: 150
                        Text {
                            text: "OMG"
                            color: "white"
                        }
                    }
                }
            }
            
            A Offline
            A Offline
            Amir Afendin
            wrote on last edited by
            #5

            @Julien-B yeah, thank you so much, already got from stackoverflow something like that

            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