SplitView项内的MouseArea使鼠标事件脱离Splitview手柄

问题描述

我正在使用qt快速控件2 SplitView,似乎MouseArea项中的任何SplitView都会使鼠标事件脱离SplitView手柄。这意味着,当手柄位于具有MouseArea的组件上方(例如, Button内的SplitView

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.13

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    SplitView {
        id: splitView
        anchors.fill: parent
        handle: Rectangle {
            id: handle
            implicitWidth: 20
            color: "red"
        }

        Page {
            id: firstPage
            Button {
                id: button
                implicitWidth: 100
                implicitHeight: 50
                text: "button"
            }
        }

        Page {
            id: secondPage
        }
    }
}

正常行为:

working gif

按钮阻止来自句柄的鼠标事件:

not working gif

我尝试将splitViewhandle的z值设置为大于firstPagebutton的z值,但这没有用。

解决方法

#include <iostream>

int main()
{
    long int number = 255;
    std::cout<< "Value 1 : " << std::flush << number << std::flush << std::endl;
    number = 15155;
    std::cout<< "Value 2 : " << std::flush << number << std::flush << std::endl;
    return 0;
}

您必须在页面上激活剪辑。 我在一个空的项目上进行了测试:: D我想把手下方的已加载按钮右侧仍然处于活动状态。 (如果有人确切知道为什么要发表评论)

,

尝试将第一页和第二页的z值设置为-1,将SplitView设置为1