问题描述
我正在使用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
}
}
}
正常行为:
按钮阻止来自句柄的鼠标事件:
我尝试将splitView
和handle
的z值设置为大于firstPage
和button
的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