qtquick: add a way to disable the default mouse redirectors

So user can use his own
This commit is contained in:
Sergio Martins
2021-03-01 23:23:04 +00:00
parent d01228d9ff
commit 6fc79d942b
2 changed files with 8 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ Rectangle {
readonly property int nonContentsHeight: titleBar.heightWhenVisible + tabbar.height
property int contentsMargin: 2
property int titleBarContentsMargin: 1
properby bool hasCustomMouseEventRedirector: false
anchors.fill: parent
@@ -108,7 +109,8 @@ Rectangle {
onTabBarCppChanged: {
if (tabBarCpp) {
tabBarCpp.redirectMouseEvents(dragMouseArea)
if (!root.hasCustomMouseEventRedirector)
tabBarCpp.redirectMouseEvents(dragMouseArea)
// Setting just so the unit-tests can access the buttons
tabBarCpp.tabBarQmlItem = this;

View File

@@ -36,6 +36,9 @@ Rectangle {
/// Don't set 'hight' directly in the overridden component
property int heightWhenVisible: 30
/// Set to true if you're using a custom MouseEventRedirector in your code
property bool hasCustomMouseEventRedirector: false
/// @brief Signal emitted by a TitleBar.qml component when the close button is clicked
signal closeButtonClicked();
@@ -58,7 +61,8 @@ Rectangle {
onTitleBarCppChanged: {
if (titleBarCpp) {
titleBarCpp.redirectMouseEvents(dragMouseArea)
if (!root.hasCustomMouseEventRedirector)
titleBarCpp.redirectMouseEvents(dragMouseArea)
// Setting just so the unit-tests can access the buttons
titleBarCpp.titleBarQmlItem = this;