FontDialog.qml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2021 The Qt Company Ltd.
  4. ** Contact: http://www.qt.io/licensing/
  5. **
  6. ** This file is part of the Qt Quick Dialogs module of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:LGPL3$
  9. ** Commercial License Usage
  10. ** Licensees holding valid commercial Qt licenses may use this file in
  11. ** accordance with the commercial license agreement provided with the
  12. ** Software or, alternatively, in accordance with the terms contained in
  13. ** a written agreement between you and The Qt Company. For licensing terms
  14. ** and conditions see http://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at http://www.qt.io/contact-us.
  16. **
  17. ** GNU Lesser General Public License Usage
  18. ** Alternatively, this file may be used under the terms of the GNU Lesser
  19. ** General Public License version 3 as published by the Free Software
  20. ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
  21. ** packaging of this file. Please review the following information to
  22. ** ensure the GNU Lesser General Public License version 3 requirements
  23. ** will be met: https://www.gnu.org/licenses/lgpl.html.
  24. **
  25. ** GNU General Public License Usage
  26. ** Alternatively, this file may be used under the terms of the GNU
  27. ** General Public License version 2.0 or later as published by the Free
  28. ** Software Foundation and appearing in the file LICENSE.GPL included in
  29. ** the packaging of this file. Please review the following information to
  30. ** ensure the GNU General Public License version 2.0 requirements will be
  31. ** met: http://www.gnu.org/licenses/gpl-2.0.html.
  32. **
  33. ** $QT_END_LICENSE$
  34. **
  35. ****************************************************************************/
  36. import QtQuick
  37. import QtQuick.Controls
  38. import QtQuick.Controls.impl
  39. import QtQuick.Dialogs
  40. import QtQuick.Dialogs.quickimpl
  41. import QtQuick.Layouts
  42. import QtQuick.Templates as T
  43. FontDialogImpl {
  44. id: control
  45. implicitWidth: Math.max(control.implicitBackgroundWidth + control.leftInset + control.rightInset,
  46. control.contentWidth + control.leftPadding + control.rightPadding,
  47. control.implicitHeaderWidth,
  48. control.implicitFooterWidth)
  49. implicitHeight: Math.max(control.implicitBackgroundHeight + control.topInset + control.bottomInset,
  50. control.contentHeight + control.topPadding + control.bottomPadding
  51. + (control.implicitHeaderHeight > 0 ? control.implicitHeaderHeight + control.spacing : 0)
  52. + (control.implicitFooterHeight > 0 ? control.implicitFooterHeight + control.spacing : 0))
  53. leftPadding: 20
  54. rightPadding: 20
  55. // Ensure that the background's border is visible.
  56. leftInset: -1
  57. rightInset: -1
  58. topInset: -1
  59. bottomInset: -1
  60. spacing: 12
  61. standardButtons: T.Dialog.Ok | T.Dialog.Cancel
  62. FontDialogImpl.buttonBox: buttonBox
  63. FontDialogImpl.familyListView: content.familyListView
  64. FontDialogImpl.styleListView: content.styleListView
  65. FontDialogImpl.sizeListView: content.sizeListView
  66. FontDialogImpl.sampleEdit: content.sampleEdit
  67. FontDialogImpl.writingSystemComboBox: writingSystemComboBox
  68. FontDialogImpl.underlineCheckBox: content.underline
  69. FontDialogImpl.strikeoutCheckBox: content.strikeout
  70. FontDialogImpl.familyEdit: content.familyEdit
  71. FontDialogImpl.styleEdit: content.styleEdit
  72. FontDialogImpl.sizeEdit: content.sizeEdit
  73. background: Rectangle {
  74. implicitWidth: 600
  75. implicitHeight: 400
  76. color: control.palette.window
  77. border.color: control.palette.dark
  78. }
  79. Overlay.modal: Rectangle {
  80. color: Color.transparent(control.palette.shadow, 0.5)
  81. }
  82. Overlay.modeless: Rectangle {
  83. color: Color.transparent(control.palette.shadow, 0.12)
  84. }
  85. header: Pane {
  86. palette.window: control.palette.light
  87. padding: 20
  88. contentItem: Label {
  89. width: parent.width
  90. text: control.title
  91. visible: control.title.length > 0
  92. horizontalAlignment: Label.AlignHCenter
  93. elide: Label.ElideRight
  94. font.bold: true
  95. }
  96. }
  97. contentItem: FontDialogContent {
  98. id: content
  99. }
  100. footer: Rectangle {
  101. color: control.palette.light
  102. implicitWidth: rowLayout.implicitWidth
  103. implicitHeight: rowLayout.implicitHeight
  104. RowLayout {
  105. id: rowLayout
  106. width: parent.width
  107. height: parent.height
  108. spacing: 20
  109. Label {
  110. text: qsTr("Writing System")
  111. Layout.leftMargin: 20
  112. }
  113. ComboBox{
  114. id: writingSystemComboBox
  115. Layout.fillWidth: true
  116. }
  117. DialogButtonBox {
  118. id: buttonBox
  119. standardButtons: control.standardButtons
  120. palette.window: control.palette.light
  121. spacing: 12
  122. horizontalPadding: 0
  123. verticalPadding: 20
  124. Layout.rightMargin: 20
  125. }
  126. }
  127. }
  128. }