Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.7
-
None
Description
In the application below, clicking outside of the menu shouldn't send mouse events to items below the menu, but it does. For some reason, Qt Creator has the same behaviour, so it seems it's the same in widgets. However, if you think about an application like MS Paint, it's not acceptable for the canvas to receive press events at the same time as a menu was closed, because it would result in unintentional brush strokes, for example.
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 ApplicationWindow { width: 300 height: 300 visible: true MouseArea { anchors.fill: parent onPressed: print("Oops!") } Menu { id: menu visible: true MenuItem { text: "Blah" } MenuItem { text: "Blah" } MenuItem { text: "Blah" } } }
I believe that this is also what causes the following to happen:
That's with code similar to this:
ToolButton { id: fileToolButton text: qsTr("File") onClicked: fileMenu.open() Menu { id: fileMenu y: fileToolButton.height MenuItem { text: qsTr("New") } } }