ToolBar.qml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.Imagine
  7. import QtQuick.Controls.Imagine.impl
  8. T.ToolBar {
  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. topPadding: SafeArea.margins.top + (background ? background.topPadding : 0)
  15. leftPadding: SafeArea.margins.left + (background ? background.leftPadding : 0)
  16. rightPadding: SafeArea.margins.right + (background ? background.rightPadding : 0)
  17. bottomPadding: SafeArea.margins.bottom + (background ? background.bottomPadding : 0)
  18. topInset: background ? -background.topInset || 0 : 0
  19. leftInset: background ? -background.leftInset || 0 : 0
  20. rightInset: background ? -background.rightInset || 0 : 0
  21. bottomInset: background ? -background.bottomInset || 0 : 0
  22. background: NinePatchImage {
  23. source: Imagine.url + "toolbar-background"
  24. NinePatchImageSelector on source {
  25. states: [
  26. {"disabled": !control.enabled},
  27. {"header": control.position === T.ToolBar.Header },
  28. {"footer": control.position === T.ToolBar.Footer },
  29. {"mirrored": control.mirrored}
  30. ]
  31. }
  32. }
  33. }