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. Drawer bug?
Forum Updated to NodeBB v4.3 + New Features

Drawer bug?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 738 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.
  • I Offline
    I Offline
    igor_stravinsky
    wrote on last edited by
    #1

    I've got a Quick Controls 2 app that has a structure that looks like this:

    Flippable
         Front
             StackView
                  Page 1
                     ListView w/ScrollBar
                  Page 2
         Back
             Tab View
                 Tab 1
                 Tab 2
                     Drawer
    
    

    I've been chasing a bug in which the ListView's scroll bar was unresponsive to mouse input. After much experimentation, I discovered that the Drawer's dragMargin, which was set to Qt.styleHints.startDragDistance was the culprit. It created a dead zone on the right side of every view (not just Tab 2), which was unresponsive to clicks.

    Is this the expected behavior of a Drawer? I would have thought that the dragMargin would only apply to the Tab2 view, not to every view in the app.
    Are Drawers intended to be global?

    1 Reply Last reply
    0
    • I Offline
      I Offline
      igor_stravinsky
      wrote on last edited by
      #2

      Here's a simple example of the bug:

      main.qml

      import QtQuick 2.10
      import QtQuick.Window 2.10
      import QtQuick.Controls 2.3
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Flipable {
              id: flipable
              anchors.fill:parent
      
              property bool flipped: false
      
              front: Front{}
              back: Back{}
      
              states: State {
                  name: "back"
                  PropertyChanges { target: rotation; angle: 180 }
                  when: flipable.flipped
              }
      
              transform: Rotation {
                  id: rotation
                  origin{ x: flipable.width/2;y: flipable.height/2 }
                  axis{ x: 0;y: -1;z: 0 }    // set axis.y to 1 to rotate around y-axis
                  angle: 0    // the default angle
              }
      
              transitions: Transition {
                  NumberAnimation { target: rotation; property: "angle"; duration: 2000 }
              }
      
      
          }
      
          RoundButton{
              height:40
              width:40
              radius:20
              anchors.right: parent.right
              anchors.bottom: parent.bottom
              text:"flip"
      
              onClicked: flipable.flipped = !flipable.flipped
          }
      }
      
      

      Front.qml:

      import QtQuick 2.10
      import QtQuick.Controls 2.3
      
      Item {
          id:frontSide
          anchors.fill:parent
      
          ListView {
              anchors.fill:parent
      
              model: 100
      
              delegate: ItemDelegate {
                  Text { text: "Item number: " + index }
                  width: parent.width
              }
      
              ScrollBar.vertical: ScrollBar {
                  policy:ScrollBar.AlwaysOn
                  width:10
              }
          }
      
      }
      

      Back.qml:

      import QtQuick 2.10
      import QtQuick.Controls 2.3
      
      Item {
          id:backSide
          anchors.fill:parent
      
          Drawer{
              id:theDrawer
              x: parent.width
              y: 0
              height: parent.height
              width: parent.width/2
              edge: Qt.RightEdge
              dragMargin: Qt.styleHints.startDragDistance
      
              Text{
                  anchors.centerIn: parent
                  text:"I'm a drawer!"
              }
      
          }
      }
      

      The code demonstrates that the scroll bar on the front side doesn't respond to clicks because of the dragMargin of the drawer on the back

      1 Reply Last reply
      0
      • jpnurmiJ Offline
        jpnurmiJ Offline
        jpnurmi
        wrote on last edited by
        #3

        It's a known problem: QTBUG-59141. In your scenario, you can mitigate the problem by setting Drawer::interactive to false when applicable.

        1 Reply Last reply
        1

        • Login

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