SplitView.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (C) 2018 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // Qt-Security score:significant reason:default
  4. import QtQuick
  5. import QtQuick.Templates as T
  6. import QtQuick.Controls.impl
  7. import QtQuick.Controls.Material
  8. T.SplitView {
  9. id: control
  10. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  11. implicitContentWidth + leftPadding + rightPadding)
  12. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  13. implicitContentHeight + topPadding + bottomPadding)
  14. handle: Rectangle {
  15. implicitWidth: control.orientation === Qt.Horizontal ? 6 : control.width
  16. implicitHeight: control.orientation === Qt.Horizontal ? control.height : 6
  17. color: T.SplitHandle.pressed ? control.Material.background
  18. : Qt.lighter(control.Material.background, T.SplitHandle.hovered ? 1.2 : 1.1)
  19. Rectangle {
  20. color: control.Material.secondaryTextColor
  21. width: control.orientation === Qt.Horizontal ? thickness : length
  22. height: control.orientation === Qt.Horizontal ? length : thickness
  23. radius: thickness
  24. x: (parent.width - width) / 2
  25. y: (parent.height - height) / 2
  26. property int length: parent.T.SplitHandle.pressed ? 3 : 8
  27. readonly property int thickness: parent.T.SplitHandle.pressed ? 3 : 1
  28. Behavior on length {
  29. NumberAnimation {
  30. duration: 100
  31. }
  32. }
  33. }
  34. }
  35. }