TabButton.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.Material
  8. import QtQuick.Controls.Material.impl
  9. T.TabButton {
  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. padding: 12
  16. spacing: 6
  17. icon.width: 24
  18. icon.height: 24
  19. icon.color: !enabled ? Material.hintTextColor : down || checked ? Material.accentColor : Material.foreground
  20. contentItem: IconLabel {
  21. spacing: control.spacing
  22. mirrored: control.mirrored
  23. display: control.display
  24. icon: control.icon
  25. text: control.text
  26. font: control.font
  27. color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.foreground
  28. }
  29. background: Ripple {
  30. implicitHeight: control.Material.touchTarget
  31. clip: true
  32. pressed: control.pressed
  33. anchor: control
  34. active: enabled && (control.down || control.visualFocus || control.hovered)
  35. color: control.Material.rippleColor
  36. }
  37. }