DefaultButton.qml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (C) 2020 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.Controls
  6. import QtQuick.Controls.impl
  7. import QtQuick.Templates as T
  8. import QtQuick.NativeStyle as NativeStyle
  9. T.Button {
  10. id: control
  11. readonly property bool __nativeBackground: background instanceof NativeStyle.StyleItem
  12. readonly property bool __notCustomizable: true
  13. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  14. implicitContentWidth + leftPadding + rightPadding)
  15. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  16. implicitContentHeight + topPadding + bottomPadding)
  17. leftPadding: __nativeBackground ? background.contentPadding.left : 5
  18. rightPadding: __nativeBackground ? background.contentPadding.right : 5
  19. topPadding: __nativeBackground ? background.contentPadding.top : 5
  20. bottomPadding: __nativeBackground ? background.contentPadding.bottom : 5
  21. background: NativeStyle.Button {
  22. control: control
  23. contentWidth: contentItem.implicitWidth
  24. contentHeight: contentItem.implicitHeight
  25. readonly property bool __ignoreNotCustomizable: true
  26. }
  27. icon.width: 24
  28. icon.height: 24
  29. icon.color: control.palette.buttonText
  30. contentItem: IconLabel {
  31. spacing: control.spacing
  32. mirrored: control.mirrored
  33. display: control.display
  34. icon: control.icon
  35. text: control.text
  36. font: control.font
  37. color: control.palette.buttonText
  38. readonly property bool __ignoreNotCustomizable: true
  39. }
  40. }