From 617e795a36334ed9f5aea7a6fb2ad54f46e72265 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 26 Sep 2016 11:21:52 +0200 Subject: [PATCH] feat(scrollBar): use style file --- tests/resources.qrc | 9 +++++---- tests/ui/components/popup/DropDownMenu.qml | 4 ---- .../components/scrollBar/ForceScrollBar.qml | 17 +++++++++-------- .../{Collapse.qml => CollapseStyle.qml} | 0 .../{Dialog.qml => DialogStyle.qml} | 0 .../components/{Popup.qml => PopupStyle.qml} | 0 tests/ui/style/components/ScrollBarStyle.qml | 19 +++++++++++++++++++ .../{SearchBox.qml => SearchBoxStyle.qml} | 0 tests/ui/style/components/qmldir | 9 +++++---- tests/ui/style/global/Colors.qml | 5 ++++- 10 files changed, 42 insertions(+), 21 deletions(-) rename tests/ui/style/components/{Collapse.qml => CollapseStyle.qml} (100%) rename tests/ui/style/components/{Dialog.qml => DialogStyle.qml} (100%) rename tests/ui/style/components/{Popup.qml => PopupStyle.qml} (100%) create mode 100644 tests/ui/style/components/ScrollBarStyle.qml rename tests/ui/style/components/{SearchBox.qml => SearchBoxStyle.qml} (100%) diff --git a/tests/resources.qrc b/tests/resources.qrc index 47eef64f3..45c3f6c6a 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -36,10 +36,11 @@ ui/components/invertedMouseArea/InvertedMouseArea.qml ui/scripts/utils.js ui/style/components/qmldir - ui/style/components/Dialog.qml - ui/style/components/Collapse.qml - ui/style/components/SearchBox.qml - ui/style/components/Popup.qml + ui/style/components/DialogStyle.qml + ui/style/components/ScrollBarStyle.qml + ui/style/components/SearchBoxStyle.qml + ui/style/components/CollapseStyle.qml + ui/style/components/PopupStyle.qml ui/style/global/qmldir ui/style/global/Colors.qml ui/style/global/Constants.qml diff --git a/tests/ui/components/popup/DropDownMenu.qml b/tests/ui/components/popup/DropDownMenu.qml index 9a38f6b2f..fd060d2d4 100644 --- a/tests/ui/components/popup/DropDownMenu.qml +++ b/tests/ui/components/popup/DropDownMenu.qml @@ -12,10 +12,6 @@ Rectangle { property int maxMenuHeight - border { - color: '#CCCCCC' - width: 2 - } implicitHeight: { var height = model.count * entryHeight return height > maxMenuHeight ? maxMenuHeight : height diff --git a/tests/ui/components/scrollBar/ForceScrollBar.qml b/tests/ui/components/scrollBar/ForceScrollBar.qml index 7a424d171..aff1a91f4 100644 --- a/tests/ui/components/scrollBar/ForceScrollBar.qml +++ b/tests/ui/components/scrollBar/ForceScrollBar.qml @@ -1,17 +1,18 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 +import 'qrc:/ui/style/components' + // =================================================================== ScrollBar { - background: Rectangle { - color: '#F4F4F4' - } + background: ScrollBarStyle.background contentItem: Rectangle { - color: scrollBar.pressed ? '#5E5E5F' : '#C5C5C5' - implicitHeight: 100 - implicitWidth: 8 - radius: 10 + color: pressed + ? ScrollBarStyle.pressedColor + : ScrollBarStyle.color + implicitHeight: ScrollBarStyle.contentItem.implicitHeight + implicitWidth: ScrollBarStyle.contentItem.implicitWidth + radius: ScrollBarStyle.contentItem.radius } - id: scrollBar } diff --git a/tests/ui/style/components/Collapse.qml b/tests/ui/style/components/CollapseStyle.qml similarity index 100% rename from tests/ui/style/components/Collapse.qml rename to tests/ui/style/components/CollapseStyle.qml diff --git a/tests/ui/style/components/Dialog.qml b/tests/ui/style/components/DialogStyle.qml similarity index 100% rename from tests/ui/style/components/Dialog.qml rename to tests/ui/style/components/DialogStyle.qml diff --git a/tests/ui/style/components/Popup.qml b/tests/ui/style/components/PopupStyle.qml similarity index 100% rename from tests/ui/style/components/Popup.qml rename to tests/ui/style/components/PopupStyle.qml diff --git a/tests/ui/style/components/ScrollBarStyle.qml b/tests/ui/style/components/ScrollBarStyle.qml new file mode 100644 index 000000000..14cd4b48d --- /dev/null +++ b/tests/ui/style/components/ScrollBarStyle.qml @@ -0,0 +1,19 @@ +pragma Singleton +import QtQuick 2.7 + +import 'qrc:/ui/style/global' + +QtObject { + property string color: Colors.c + property string pressedColor: Colors.b + + property Rectangle background: Rectangle { + color: Colors.d + } + + property Rectangle contentItem: Rectangle { + implicitHeight: 100 + implicitWidth: 8 + radius: 10 + } +} diff --git a/tests/ui/style/components/SearchBox.qml b/tests/ui/style/components/SearchBoxStyle.qml similarity index 100% rename from tests/ui/style/components/SearchBox.qml rename to tests/ui/style/components/SearchBoxStyle.qml diff --git a/tests/ui/style/components/qmldir b/tests/ui/style/components/qmldir index c0274055c..5a9eb7e9a 100644 --- a/tests/ui/style/components/qmldir +++ b/tests/ui/style/components/qmldir @@ -2,7 +2,8 @@ module Style -singleton CollapseStyle 1.0 Collapse.qml -singleton DialogStyle 1.0 Dialog.qml -singleton PopupStyle 1.0 Popup.qml -singleton SearchBoxStyle 1.0 SearchBox.qml +singleton CollapseStyle 1.0 CollapseStyle.qml +singleton DialogStyle 1.0 DialogStyle.qml +singleton PopupStyle 1.0 PopupStyle.qml +singleton SearchBoxStyle 1.0 SearchBoxStyle.qml +singleton ScrollBarStyle 1.0 ScrollBarStyle.qml diff --git a/tests/ui/style/global/Colors.qml b/tests/ui/style/global/Colors.qml index e7516bf03..9764a423f 100644 --- a/tests/ui/style/global/Colors.qml +++ b/tests/ui/style/global/Colors.qml @@ -2,5 +2,8 @@ pragma Singleton import QtQuick 2.7 QtObject { - property string a: '#800000' + property string a: '#808080' + property string b: '#5E5E5F' + property string c: '#C5C5C5' + property string d: '#F4F4F4' }