Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50305

StackView: push new item over double-clicked item breaks mouse events

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0
    • 5.6.0 Beta
    • Quick: Controls 2
    • None
    • Mageia Linux Cauldsron x86_64, gcc 5.3.1
    • 4d26036772f897c293d8f71d728ed41c720a85e8

    Description

      In the test program new item pushed onto the stack by double click. Using StackView from QtQuick Controls 1, I see the following events in MouseArea:

      pressed
      released
      clicked
      pressed
      double-clicked
      released

      If I click on "Pop" button and again double click, I see the same events.

      With StackView from Qt labs controls situation is different. The first time I do double click, I see the same events and also in the end press-and-hold event. I made menu popup on this event and on double click menu popup also over the newly pushed item.
      If I click on "Pop" button and again double click, I see different events:

      pressed
      double-clicked
      press-and-hold

      And I only see this events until I restart the program.

      import QtQuick 2.5
      import QtQuick.Layouts 1.3
      import QtQuick.Controls 1.4 as C1
      import Qt.labs.controls 1.0 as C2
      
      C2.ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          C1.Menu {
              id: menu
      
              C1.MenuItem {
                  text: "test menu"
              }
          }
      
          Item {
              id: firstItem
      
              Text {
                  anchors.centerIn: parent
                  text: "Double click here!"
              }
      
              MouseArea {
                  anchors.fill: parent
      
                  onClicked: console.log("clicked")
                  onDoubleClicked: {
                      console.log("double-clicked")
                      stackView.push(topComponent)
                  }
                  onPressed: console.log("pressed")
                  onPressAndHold: {
                      menu.popup()
                      console.log("press-and-hold")
                  }
                  onReleased: console.log("released")
              }
          }
      
          Component {
              id: topComponent
      
              Item {
                  Text {
                      anchors.centerIn: parent
                      text: "The top item"
                  }
              }
          }
      
          ColumnLayout {
              anchors.fill: parent
              spacing: 10
      
      //        C1.StackView {
              C2.StackView {
                  id: stackView
      
                  Layout.fillHeight: true
                  Layout.fillWidth: true
                  initialItem: firstItem
              }
      
              Row {
                  Layout.alignment: Qt.AlignHCenter
      
                  C2.Button {
                      text: "Pop"
                      onClicked: stackView.pop()
                  }
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            krnekit Nikita Krupenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes