MenuBarItem.qml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.MenuBarItem {
  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. implicitIndicatorHeight + topPadding + bottomPadding)
  16. padding: 16
  17. verticalPadding: 12
  18. spacing: 16
  19. icon.width: 24
  20. icon.height: 24
  21. icon.color: enabled ? Material.foreground : Material.hintTextColor
  22. contentItem: IconLabel {
  23. spacing: control.spacing
  24. mirrored: control.mirrored
  25. display: control.display
  26. alignment: Qt.AlignLeft
  27. icon: control.icon
  28. text: control.text
  29. font: control.font
  30. color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
  31. }
  32. background: Rectangle {
  33. implicitWidth: 40
  34. implicitHeight: 40
  35. color: control.highlighted ? control.Material.listHighlightColor : "transparent"
  36. Ripple {
  37. width: parent.width
  38. height: parent.height
  39. clip: visible
  40. pressed: control.pressed
  41. anchor: control
  42. active: control.down || control.highlighted
  43. color: control.Material.rippleColor
  44. }
  45. }
  46. }