From 0ea5a7635ce3896c84752527789df7b3515bb651 Mon Sep 17 00:00:00 2001 From: vladest Date: Tue, 21 Nov 2017 16:32:57 +0100 Subject: [PATCH 1/9] Added mouse press and release events to be sent along with touch events to Tablet --- interface/src/ui/overlays/Web3DOverlay.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index d418a79fbf..4576a8dcd8 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -368,7 +368,6 @@ void Web3DOverlay::handlePointerEventAsTouch(const PointerEvent& event) { return; } - QPointF windowPoint; { glm::vec2 windowPos = event.getPos2D() * (METERS_TO_INCHES * _dpi); @@ -433,10 +432,8 @@ void Web3DOverlay::handlePointerEventAsTouch(const PointerEvent& event) { } #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) - if (event.getType() == PointerEvent::Move) { - QMouseEvent mouseEvent(QEvent::MouseMove, windowPoint, windowPoint, windowPoint, button, buttons, Qt::NoModifier); - QCoreApplication::sendEvent(_webSurface->getWindow(), &mouseEvent); - } + //needed for ScrollBars + handlePointerEventAsMouse(event); #endif if (touchType == QEvent::TouchBegin) { @@ -451,10 +448,8 @@ void Web3DOverlay::handlePointerEventAsTouch(const PointerEvent& event) { } #if QT_VERSION < QT_VERSION_CHECK(5, 9, 0) - if (event.getType() == PointerEvent::Move) { - QMouseEvent mouseEvent(QEvent::MouseMove, windowPoint, windowPoint, windowPoint, button, buttons, Qt::NoModifier); - QCoreApplication::sendEvent(_webSurface->getWindow(), &mouseEvent); - } + //needed for ScrollBars + handlePointerEventAsMouse(event); #endif } From a56e4e10c30d6bba832cd1b2f46b834ff8fd91fe Mon Sep 17 00:00:00 2001 From: vladest Date: Tue, 21 Nov 2017 21:44:04 +0100 Subject: [PATCH 2/9] Remove unused variables --- interface/src/ui/overlays/Web3DOverlay.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 4576a8dcd8..b654241f23 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -422,14 +422,6 @@ void Web3DOverlay::handlePointerEventAsTouch(const PointerEvent& event) { // // In Qt 5.9 mouse events must be sent before touch events to make sure some QtQuick components will // receive mouse events - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = Qt::NoButton; - if (event.getButton() == PointerEvent::PrimaryButton) { - button = Qt::LeftButton; - } - if (event.getButtons() & PointerEvent::PrimaryButton) { - buttons |= Qt::LeftButton; - } #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) //needed for ScrollBars From 22d57f11038772267c00a2c3bbf32f969bc760de Mon Sep 17 00:00:00 2001 From: vladest Date: Thu, 23 Nov 2017 14:56:15 +0100 Subject: [PATCH 3/9] Fix click events from mouse --- interface/src/ui/overlays/Web3DOverlay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 4fcc8fd8d4..bde16f2690 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -364,8 +364,8 @@ void Web3DOverlay::hoverLeaveOverlay(const PointerEvent& event) { void Web3DOverlay::handlePointerEvent(const PointerEvent& event) { if (_inputMode == Touch) { - handlePointerEventAsTouch(event); handlePointerEventAsMouse(event); + handlePointerEventAsTouch(event); } else { handlePointerEventAsMouse(event); } From b69b580a6811b77f79a32336f924021210bef285 Mon Sep 17 00:00:00 2001 From: vladest Date: Thu, 23 Nov 2017 23:08:43 +0100 Subject: [PATCH 4/9] Use ScrollBar from QQC2 which is supports both mouse and touch events --- .../resources/qml/controls-uit/Table.qml | 109 ++++++++---------- interface/src/ui/overlays/Web3DOverlay.cpp | 1 - 2 files changed, 47 insertions(+), 63 deletions(-) diff --git a/interface/resources/qml/controls-uit/Table.qml b/interface/resources/qml/controls-uit/Table.qml index 11d1920f95..602b4456a8 100644 --- a/interface/resources/qml/controls-uit/Table.qml +++ b/interface/resources/qml/controls-uit/Table.qml @@ -11,6 +11,7 @@ import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.2 as QQC2 import "../styles-uit" @@ -24,6 +25,51 @@ TableView { model: ListModel { } + Component.onCompleted: { + tableView.flickableItem.QQC2.ScrollBar.vertical = scrollbar + } + + QQC2.ScrollBar { + id: scrollbar + parent: tableView.flickableItem + policy: QQC2.ScrollBar.AsNeeded + orientation: Qt.Vertical + visible: size < 1.0 + topPadding: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 + anchors.top: tableView.flickableItem.top + anchors.left: tableView.flickableItem.right + anchors.bottom: tableView.flickableItem.bottom + + background: Item { + implicitWidth: hifi.dimensions.scrollbarBackgroundWidth + Rectangle { + anchors { + fill: parent; + topMargin: hifi.dimensions.tableHeaderHeight + } + color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight + : hifi.colors.tableScrollBackgroundDark + } + } + + contentItem: Item { + id: scrollbarHandle + + implicitWidth: hifi.dimensions.scrollbarHandleWidth + Rectangle { + anchors { + fill: parent + topMargin: 3 + bottomMargin: 3 // "" + leftMargin: 1 // Move it right + rightMargin: -1 // "" + } + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark + } + } + } + headerVisible: false headerDelegate: Rectangle { height: hifi.dimensions.tableHeaderHeight @@ -98,74 +144,13 @@ TableView { backgroundVisible: true horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - verticalScrollBarPolicy: Qt.ScrollBarAsNeeded + verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff style: TableViewStyle { // Needed in order for rows to keep displaying rows after end of table entries. backgroundColor: tableView.isLightColorScheme ? hifi.colors.tableBackgroundLight : hifi.colors.tableBackgroundDark alternateBackgroundColor: tableView.isLightColorScheme ? hifi.colors.tableRowLightOdd : hifi.colors.tableRowDarkOdd - padding.top: headerVisible ? hifi.dimensions.tableHeaderHeight: 0 - - handle: Item { - id: scrollbarHandle - implicitWidth: hifi.dimensions.scrollbarHandleWidth - Rectangle { - anchors { - fill: parent - topMargin: 3 - bottomMargin: 3 // "" - leftMargin: 1 // Move it right - rightMargin: -1 // "" - } - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark - } - } - - scrollBarBackground: Item { - implicitWidth: hifi.dimensions.scrollbarBackgroundWidth - Rectangle { - anchors { - fill: parent - margins: -1 // Expand - topMargin: -1 - } - color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark - - // Extend header color above scrollbar background - Rectangle { - anchors { - top: parent.top - topMargin: -hifi.dimensions.tableHeaderHeight - left: parent.left - right: parent.right - } - height: hifi.dimensions.tableHeaderHeight - color: tableView.isLightColorScheme ? hifi.colors.tableBackgroundLight : hifi.colors.tableBackgroundDark - visible: headerVisible - } - Rectangle { - // Extend header bottom border - anchors { - top: parent.top - left: parent.left - right: parent.right - } - height: 1 - color: isLightColorScheme ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight - visible: headerVisible - } - } - } - - incrementControl: Item { - visible: false - } - - decrementControl: Item { - visible: false - } } rowDelegate: Rectangle { diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index bde16f2690..34b8c6c865 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -364,7 +364,6 @@ void Web3DOverlay::hoverLeaveOverlay(const PointerEvent& event) { void Web3DOverlay::handlePointerEvent(const PointerEvent& event) { if (_inputMode == Touch) { - handlePointerEventAsMouse(event); handlePointerEventAsTouch(event); } else { handlePointerEventAsMouse(event); From 73a557a8a4d8a4a4a4905c91fe3f5f64c91a6e5b Mon Sep 17 00:00:00 2001 From: vladest Date: Fri, 24 Nov 2017 15:58:27 +0100 Subject: [PATCH 5/9] Added Scroll Bar for Trees. Fixed some anchoring issues. Fixed headerless views --- .../resources/qml/controls-uit/Table.qml | 12 +- interface/resources/qml/controls-uit/Tree.qml | 113 ++++++++---------- 2 files changed, 58 insertions(+), 67 deletions(-) diff --git a/interface/resources/qml/controls-uit/Table.qml b/interface/resources/qml/controls-uit/Table.qml index 602b4456a8..45526428b2 100644 --- a/interface/resources/qml/controls-uit/Table.qml +++ b/interface/resources/qml/controls-uit/Table.qml @@ -26,7 +26,9 @@ TableView { model: ListModel { } Component.onCompleted: { - tableView.flickableItem.QQC2.ScrollBar.vertical = scrollbar + if (flickableItem !== null && flickableItem !== undefined) { + tableView.flickableItem.QQC2.ScrollBar.vertical = scrollbar + } } QQC2.ScrollBar { @@ -36,16 +38,16 @@ TableView { orientation: Qt.Vertical visible: size < 1.0 topPadding: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 - anchors.top: tableView.flickableItem.top - anchors.left: tableView.flickableItem.right - anchors.bottom: tableView.flickableItem.bottom + anchors.top: tableView.top + anchors.left: tableView.right + anchors.bottom: tableView.bottom background: Item { implicitWidth: hifi.dimensions.scrollbarBackgroundWidth Rectangle { anchors { fill: parent; - topMargin: hifi.dimensions.tableHeaderHeight + topMargin: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark diff --git a/interface/resources/qml/controls-uit/Tree.qml b/interface/resources/qml/controls-uit/Tree.qml index 79d3b958ea..7a9fdfb93f 100644 --- a/interface/resources/qml/controls-uit/Tree.qml +++ b/interface/resources/qml/controls-uit/Tree.qml @@ -9,9 +9,11 @@ // import QtQml.Models 2.2 -import QtQuick 2.5 +import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 +import QtQuick.Controls 2.2 as QQC2 + import "../styles-uit" @@ -35,6 +37,53 @@ TreeView { headerVisible: false + Component.onCompleted: { + if (flickableItem !== null && flickableItem !== undefined) { + treeView.flickableItem.QQC2.ScrollBar.vertical = scrollbar + } + } + + QQC2.ScrollBar { + id: scrollbar + parent: treeView.flickableItem + policy: QQC2.ScrollBar.AsNeeded + orientation: Qt.Vertical + visible: size < 1.0 + topPadding: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 + anchors.top: treeView.top + anchors.left: treeView.right + anchors.bottom: treeView.bottom + + background: Item { + implicitWidth: hifi.dimensions.scrollbarBackgroundWidth + Rectangle { + anchors { + fill: parent; + topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 + } + color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight + : hifi.colors.tableScrollBackgroundDark + } + } + + contentItem: Item { + id: scrollbarHandle + + implicitWidth: hifi.dimensions.scrollbarHandleWidth + Rectangle { + anchors { + fill: parent + topMargin: 3 + bottomMargin: 3 // "" + leftMargin: 1 // Move it right + rightMargin: -1 // "" + } + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark + } + } + } + // Use rectangle to draw border with rounded corners. frameVisible: false Rectangle { @@ -50,7 +99,7 @@ TreeView { backgroundVisible: true horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - verticalScrollBarPolicy: Qt.ScrollBarAsNeeded + verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff style: TreeViewStyle { // Needed in order for rows to keep displaying rows after end of table entries. @@ -126,66 +175,6 @@ TreeView { leftMargin: hifi.dimensions.tablePadding / 2 } } - - handle: Item { - id: scrollbarHandle - implicitWidth: hifi.dimensions.scrollbarHandleWidth - Rectangle { - anchors { - fill: parent - topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight + 3 : 3 - bottomMargin: 3 // "" - leftMargin: 1 // Move it right - rightMargin: -1 // "" - } - radius: hifi.dimensions.scrollbarHandleWidth / 2 - color: treeView.isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark - } - } - - scrollBarBackground: Item { - implicitWidth: hifi.dimensions.scrollbarBackgroundWidth - Rectangle { - anchors { - fill: parent - topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight - 1 : -1 - margins: -1 // Expand - } - color: treeView.isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark - - // Extend header color above scrollbar background - Rectangle { - anchors { - top: parent.top - topMargin: -hifi.dimensions.tableHeaderHeight - left: parent.left - right: parent.right - } - height: hifi.dimensions.tableHeaderHeight - color: treeView.isLightColorScheme ? hifi.colors.tableBackgroundLight : hifi.colors.tableBackgroundDark - visible: treeView.headerVisible - } - Rectangle { - // Extend header bottom border - anchors { - top: parent.top - left: parent.left - right: parent.right - } - height: 1 - color: treeView.isLightColorScheme ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight - visible: treeView.headerVisible - } - } - } - - incrementControl: Item { - visible: false - } - - decrementControl: Item { - visible: false - } } rowDelegate: Rectangle { From 6136a4cea6779189c2effeb0da81422a6a7dcac7 Mon Sep 17 00:00:00 2001 From: vladest Date: Sat, 25 Nov 2017 10:03:56 +0100 Subject: [PATCH 6/9] Rounded background --- interface/resources/qml/controls-uit/Table.qml | 5 +++-- interface/resources/qml/controls-uit/Tree.qml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/controls-uit/Table.qml b/interface/resources/qml/controls-uit/Table.qml index 45526428b2..5421ad5a9e 100644 --- a/interface/resources/qml/controls-uit/Table.qml +++ b/interface/resources/qml/controls-uit/Table.qml @@ -49,6 +49,7 @@ TableView { fill: parent; topMargin: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } + radius: hifi.dimensions.scrollbarHandleWidth/2 color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark } @@ -60,8 +61,8 @@ TableView { implicitWidth: hifi.dimensions.scrollbarHandleWidth Rectangle { anchors { - fill: parent - topMargin: 3 + fill: parent; + topMargin: 3; bottomMargin: 3 // "" leftMargin: 1 // Move it right rightMargin: -1 // "" diff --git a/interface/resources/qml/controls-uit/Tree.qml b/interface/resources/qml/controls-uit/Tree.qml index 7a9fdfb93f..6535049fd4 100644 --- a/interface/resources/qml/controls-uit/Tree.qml +++ b/interface/resources/qml/controls-uit/Tree.qml @@ -61,6 +61,7 @@ TreeView { fill: parent; topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } + radius: hifi.dimensions.scrollbarHandleWidth/2 color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark } From 94937374c5d25d1d22804be801d78b53eaaa9bf2 Mon Sep 17 00:00:00 2001 From: vladest Date: Tue, 28 Nov 2017 21:33:13 +0100 Subject: [PATCH 7/9] Make selection not visible under rounded scrollbar --- .../resources/qml/controls-uit/Table.qml | 29 ++++++++---------- interface/resources/qml/controls-uit/Tree.qml | 30 ++++++++----------- 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/interface/resources/qml/controls-uit/Table.qml b/interface/resources/qml/controls-uit/Table.qml index 5421ad5a9e..85b11062b8 100644 --- a/interface/resources/qml/controls-uit/Table.qml +++ b/interface/resources/qml/controls-uit/Table.qml @@ -45,31 +45,26 @@ TableView { background: Item { implicitWidth: hifi.dimensions.scrollbarBackgroundWidth Rectangle { + color: isLightColorScheme ? hifi.colors.tableBackgroundLight + : hifi.colors.tableBackgroundDark anchors { fill: parent; topMargin: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight - : hifi.colors.tableScrollBackgroundDark + + Rectangle { + anchors.fill: parent; + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight + : hifi.colors.tableScrollBackgroundDark + } } } - contentItem: Item { - id: scrollbarHandle - + contentItem: Rectangle { implicitWidth: hifi.dimensions.scrollbarHandleWidth - Rectangle { - anchors { - fill: parent; - topMargin: 3; - bottomMargin: 3 // "" - leftMargin: 1 // Move it right - rightMargin: -1 // "" - } - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark - } + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark } } diff --git a/interface/resources/qml/controls-uit/Tree.qml b/interface/resources/qml/controls-uit/Tree.qml index 6535049fd4..7008192c86 100644 --- a/interface/resources/qml/controls-uit/Tree.qml +++ b/interface/resources/qml/controls-uit/Tree.qml @@ -53,35 +53,29 @@ TreeView { anchors.top: treeView.top anchors.left: treeView.right anchors.bottom: treeView.bottom - background: Item { implicitWidth: hifi.dimensions.scrollbarBackgroundWidth Rectangle { + color: isLightColorScheme ? hifi.colors.tableBackgroundLight + : hifi.colors.tableBackgroundDark anchors { fill: parent; topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight - : hifi.colors.tableScrollBackgroundDark + + Rectangle { + anchors.fill: parent; + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight + : hifi.colors.tableScrollBackgroundDark + } } } - contentItem: Item { - id: scrollbarHandle - + contentItem: Rectangle { implicitWidth: hifi.dimensions.scrollbarHandleWidth - Rectangle { - anchors { - fill: parent - topMargin: 3 - bottomMargin: 3 // "" - leftMargin: 1 // Move it right - rightMargin: -1 // "" - } - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark - } + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark } } From 7283f0127b94b64348565181baafa6d20b141706 Mon Sep 17 00:00:00 2001 From: vladest Date: Tue, 28 Nov 2017 22:21:52 +0100 Subject: [PATCH 8/9] return back square background for scroll bars --- .../resources/qml/controls-uit/Table.qml | 26 +++++++------ interface/resources/qml/controls-uit/Tree.qml | 37 ++++++++++--------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/interface/resources/qml/controls-uit/Table.qml b/interface/resources/qml/controls-uit/Table.qml index 85b11062b8..599a7db519 100644 --- a/interface/resources/qml/controls-uit/Table.qml +++ b/interface/resources/qml/controls-uit/Table.qml @@ -45,26 +45,28 @@ TableView { background: Item { implicitWidth: hifi.dimensions.scrollbarBackgroundWidth Rectangle { - color: isLightColorScheme ? hifi.colors.tableBackgroundLight - : hifi.colors.tableBackgroundDark anchors { fill: parent; topMargin: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } - - Rectangle { - anchors.fill: parent; - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight - : hifi.colors.tableScrollBackgroundDark - } + color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight + : hifi.colors.tableScrollBackgroundDark } } - contentItem: Rectangle { + contentItem: Item { implicitWidth: hifi.dimensions.scrollbarHandleWidth - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark + Rectangle { + anchors { + fill: parent + topMargin: 3 + bottomMargin: 3 // "" + leftMargin: 1 // Move it right + rightMargin: -1 // "" + } + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark + } } } diff --git a/interface/resources/qml/controls-uit/Tree.qml b/interface/resources/qml/controls-uit/Tree.qml index 7008192c86..f3b26731da 100644 --- a/interface/resources/qml/controls-uit/Tree.qml +++ b/interface/resources/qml/controls-uit/Tree.qml @@ -53,29 +53,32 @@ TreeView { anchors.top: treeView.top anchors.left: treeView.right anchors.bottom: treeView.bottom + background: Item { implicitWidth: hifi.dimensions.scrollbarBackgroundWidth Rectangle { - color: isLightColorScheme ? hifi.colors.tableBackgroundLight - : hifi.colors.tableBackgroundDark anchors { fill: parent; topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 } - - Rectangle { - anchors.fill: parent; - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight - : hifi.colors.tableScrollBackgroundDark - } + color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight + : hifi.colors.tableScrollBackgroundDark } } - contentItem: Rectangle { + contentItem: Item { implicitWidth: hifi.dimensions.scrollbarHandleWidth - radius: hifi.dimensions.scrollbarHandleWidth/2 - color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark + Rectangle { + anchors { + fill: parent + topMargin: 3 + bottomMargin: 3 // "" + leftMargin: 1 // Move it right + rightMargin: -1 // "" + } + radius: hifi.dimensions.scrollbarHandleWidth/2 + color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark + } } } @@ -177,8 +180,8 @@ TreeView { color: styleData.selected ? hifi.colors.primaryHighlight : treeView.isLightColorScheme - ? (styleData.alternate ? hifi.colors.tableRowLightEven : hifi.colors.tableRowLightOdd) - : (styleData.alternate ? hifi.colors.tableRowDarkEven : hifi.colors.tableRowDarkOdd) + ? (styleData.alternate ? hifi.colors.tableRowLightEven : hifi.colors.tableRowLightOdd) + : (styleData.alternate ? hifi.colors.tableRowDarkEven : hifi.colors.tableRowDarkOdd) } itemDelegate: FiraSansSemiBold { @@ -193,9 +196,9 @@ TreeView { text: styleData.value size: hifi.fontSizes.tableText color: colorScheme == hifi.colorSchemes.light - ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) - : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) - + ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) + : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) + elide: Text.ElideRight } From dfeefe53b86a577d8ad7dd08f115f0aa56f07490 Mon Sep 17 00:00:00 2001 From: vladest Date: Thu, 30 Nov 2017 11:40:02 +0100 Subject: [PATCH 9/9] Make scroll bar handle centered on shaft. Width chaned on par with entities list html view --- interface/resources/qml/controls-uit/Table.qml | 12 +++--------- interface/resources/qml/controls-uit/Tree.qml | 14 ++++---------- .../resources/qml/styles-uit/HifiConstants.qml | 2 +- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/interface/resources/qml/controls-uit/Table.qml b/interface/resources/qml/controls-uit/Table.qml index 599a7db519..1443cd5d6e 100644 --- a/interface/resources/qml/controls-uit/Table.qml +++ b/interface/resources/qml/controls-uit/Table.qml @@ -37,7 +37,7 @@ TableView { policy: QQC2.ScrollBar.AsNeeded orientation: Qt.Vertical visible: size < 1.0 - topPadding: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 + topPadding: tableView.headerVisible ? hifi.dimensions.tableHeaderHeight + 1 : 1 anchors.top: tableView.top anchors.left: tableView.right anchors.bottom: tableView.bottom @@ -57,14 +57,8 @@ TableView { contentItem: Item { implicitWidth: hifi.dimensions.scrollbarHandleWidth Rectangle { - anchors { - fill: parent - topMargin: 3 - bottomMargin: 3 // "" - leftMargin: 1 // Move it right - rightMargin: -1 // "" - } - radius: hifi.dimensions.scrollbarHandleWidth/2 + anchors.fill: parent + radius: (width - 4)/2 color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark } } diff --git a/interface/resources/qml/controls-uit/Tree.qml b/interface/resources/qml/controls-uit/Tree.qml index f3b26731da..6bd11295b1 100644 --- a/interface/resources/qml/controls-uit/Tree.qml +++ b/interface/resources/qml/controls-uit/Tree.qml @@ -49,7 +49,7 @@ TreeView { policy: QQC2.ScrollBar.AsNeeded orientation: Qt.Vertical visible: size < 1.0 - topPadding: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 + topPadding: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight + 1 : 1 anchors.top: treeView.top anchors.left: treeView.right anchors.bottom: treeView.bottom @@ -59,7 +59,7 @@ TreeView { Rectangle { anchors { fill: parent; - topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight : 0 + topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight: 0 } color: isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark @@ -69,14 +69,8 @@ TreeView { contentItem: Item { implicitWidth: hifi.dimensions.scrollbarHandleWidth Rectangle { - anchors { - fill: parent - topMargin: 3 - bottomMargin: 3 // "" - leftMargin: 1 // Move it right - rightMargin: -1 // "" - } - radius: hifi.dimensions.scrollbarHandleWidth/2 + anchors.fill: parent + radius: (width - 4)/2 color: isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark } } diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index a0af92dec0..cf800cb62e 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -162,7 +162,7 @@ Item { readonly property real controlLineHeight: 28 // Height of spinbox control on 1920 x 1080 monitor readonly property real controlInterlineHeight: 21 // 75% of controlLineHeight readonly property vector2d menuPadding: Qt.vector2d(14, 102) - readonly property real scrollbarBackgroundWidth: 18 + readonly property real scrollbarBackgroundWidth: 20 readonly property real scrollbarHandleWidth: scrollbarBackgroundWidth - 2 readonly property real tabletMenuHeader: 90 }