MenuBarItem.qml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. T.MenuBarItem {
  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. implicitIndicatorHeight + topPadding + bottomPadding)
  14. spacing: 6
  15. padding: 6
  16. leftPadding: 12
  17. rightPadding: 16
  18. icon.width: 24
  19. icon.height: 24
  20. icon.color: control.palette.buttonText
  21. contentItem: IconLabel {
  22. spacing: control.spacing
  23. mirrored: control.mirrored
  24. display: control.display
  25. alignment: Qt.AlignLeft
  26. icon: control.icon
  27. text: control.text
  28. font: control.font
  29. color: control.palette.buttonText
  30. }
  31. background: Rectangle {
  32. implicitWidth: 40
  33. implicitHeight: 40
  34. color: control.down || control.highlighted ? control.palette.mid : "transparent"
  35. border.color: control.palette.dark
  36. border.width: Qt.styleHints.accessibility.contrastPreference === Qt.HighContrast &&
  37. control.highlighted ? 1 : 0
  38. }
  39. }