ToolBar.qml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright (C) 2017 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.Fusion
  8. import QtQuick.Controls.Fusion.impl
  9. T.ToolBar {
  10. id: control
  11. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  12. implicitContentWidth + leftPadding + rightPadding)
  13. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  14. implicitContentHeight + topPadding + bottomPadding)
  15. leftPadding: SafeArea.margins.left + 6
  16. rightPadding: SafeArea.margins.right + 6
  17. topPadding: SafeArea.margins.top
  18. + (control.position === T.ToolBar.Footer ? 1 : 0)
  19. bottomPadding: SafeArea.margins.bottom
  20. + (control.position === T.ToolBar.Header ? 1 : 0)
  21. background: Rectangle {
  22. implicitHeight: 26
  23. gradient: Gradient {
  24. GradientStop {
  25. position: 0
  26. color: Qt.lighter(control.palette.window, 1.04)
  27. }
  28. GradientStop {
  29. position: 1
  30. color: control.palette.window
  31. }
  32. }
  33. Rectangle {
  34. width: parent.width
  35. height: 1
  36. color: control.position === T.ToolBar.Header ? Fusion.lightShade : Fusion.darkShade
  37. }
  38. Rectangle {
  39. y: parent.height - height
  40. width: parent.width
  41. height: 1
  42. color: control.position === T.ToolBar.Header ? Fusion.darkShade : Fusion.lightShade
  43. }
  44. }
  45. }