ToolBar.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (C) 2024 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.FluentWinUI3.impl as Impl
  7. T.ToolBar {
  8. id: control
  9. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  10. implicitContentWidth + leftPadding + rightPadding)
  11. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  12. implicitContentHeight + topPadding + bottomPadding)
  13. spacing: __config.spacing || 0
  14. topPadding: SafeArea.margins.top + (__config.topPadding || 0)
  15. bottomPadding: SafeArea.margins.bottom + (__config.bottomPadding || 0)
  16. leftPadding: SafeArea.margins.left + (__config.leftPadding || 0)
  17. rightPadding: SafeArea.margins.right + (__config.rightPadding || 0)
  18. topInset: -__config.topInset || 0
  19. bottomInset: -__config.bottomInset || 0
  20. leftInset: -__config.leftInset || 0
  21. rightInset: -__config.rightInset || 0
  22. readonly property string __currentState: position === ToolBar.Header
  23. ? (enabled ? "normal" : "disabled")
  24. : (enabled ? "normal_footer" : "disabled_footer")
  25. readonly property var __config: Config.controls.toolbar[__currentState] || {}
  26. background: Impl.StyleImage {
  27. imageConfig: control.__config.background
  28. }
  29. }