ToolButton.qml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2021 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  5. **
  6. ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:COMM$
  9. **
  10. ** Commercial License Usage
  11. ** Licensees holding valid commercial Qt licenses may use this file in
  12. ** accordance with the commercial license agreement provided with the
  13. ** Software or, alternatively, in accordance with the terms contained in
  14. ** a written agreement between you and The Qt Company. For licensing terms
  15. ** and conditions see https://www.qt.io/terms-conditions. For further
  16. ** information use the contact form at https://www.qt.io/contact-us.
  17. **
  18. ** $QT_END_LICENSE$
  19. **
  20. **
  21. **
  22. **
  23. **
  24. **
  25. **
  26. **
  27. **
  28. **
  29. **
  30. **
  31. **
  32. **
  33. **
  34. **
  35. **
  36. **
  37. **
  38. ****************************************************************************/
  39. import QtQuick 2.2
  40. import QtQuick.Controls 1.2
  41. import QtQuick.Controls.Private 1.0
  42. /*!
  43. \qmltype ToolButton
  44. \inqmlmodule QtQuick.Controls
  45. \since 5.1
  46. \ingroup controls
  47. \brief Provides a button type that is typically used within a ToolBar.
  48. \image toolbar.png
  49. ToolButton is functionally similar to \l {QtQuick.Controls::}{Button}, but
  50. can provide a look that is more suitable within a \l ToolBar.
  51. \code
  52. ApplicationWindow {
  53. ...
  54. toolBar: ToolBar {
  55. RowLayout {
  56. ToolButton {
  57. iconSource: "new.png"
  58. }
  59. ToolButton {
  60. iconSource: "open.png"
  61. }
  62. ToolButton {
  63. iconSource: "save-as.png"
  64. }
  65. Item { Layout.fillWidth: true }
  66. CheckBox {
  67. text: "Enabled"
  68. checked: true
  69. }
  70. }
  71. }
  72. }
  73. \endcode
  74. You can create a custom appearance for a ToolButton by
  75. assigning a \l {ButtonStyle}.
  76. */
  77. Button {
  78. id: button
  79. style: Settings.styleComponent(Settings.style, "ToolButtonStyle.qml", button)
  80. }