FontDialogContent.qml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. GridLayout {
  43. property alias familyListView: fontFamilyListView
  44. property alias styleListView: fontStyleListView
  45. property alias sizeListView: fontSizeListView
  46. property alias sampleEdit: fontSample
  47. property alias underline: fontUnderline
  48. property alias strikeout: fontStrikeout
  49. property alias familyEdit: fontFamilyEdit
  50. property alias styleEdit: fontStyleEdit
  51. property alias sizeEdit: fontSizeEdit
  52. columns: 3
  53. ColumnLayout {
  54. spacing: 0
  55. Layout.preferredWidth: 50
  56. Label {
  57. text: qsTr("Family")
  58. Layout.alignment: Qt.AlignLeft
  59. }
  60. TextField {
  61. id: fontFamilyEdit
  62. objectName: "familyEdit"
  63. readOnly: true
  64. Layout.fillWidth: true
  65. focus: true
  66. }
  67. Frame {
  68. Layout.fillWidth: true
  69. Layout.fillHeight: true
  70. background: Rectangle {
  71. color: "white"
  72. }
  73. ListView {
  74. id: fontFamilyListView
  75. objectName: "familyListView"
  76. implicitHeight: 200
  77. anchors.fill: parent
  78. clip: true
  79. ScrollBar.vertical: ScrollBar {
  80. policy: ScrollBar.AlwaysOn
  81. }
  82. boundsBehavior: Flickable.StopAtBounds
  83. highlightMoveVelocity: -1
  84. highlightMoveDuration: 1
  85. highlightFollowsCurrentItem: true
  86. keyNavigationEnabled: true
  87. delegate: ItemDelegate {
  88. width: ListView.view.width
  89. highlighted: ListView.isCurrentItem
  90. onClicked: () => fontFamilyListView.currentIndex = index
  91. text: modelData
  92. }
  93. }
  94. }
  95. }
  96. ColumnLayout {
  97. spacing: 0
  98. Layout.preferredWidth: 30
  99. Label {
  100. text: qsTr("Style")
  101. Layout.alignment: Qt.AlignLeft
  102. }
  103. TextField {
  104. id: fontStyleEdit
  105. objectName: "styleEdit"
  106. readOnly: true
  107. Layout.fillWidth: true
  108. }
  109. Frame {
  110. Layout.fillWidth: true
  111. Layout.fillHeight: true
  112. background: Rectangle {
  113. color: "white"
  114. }
  115. ListView {
  116. id: fontStyleListView
  117. objectName: "styleListView"
  118. implicitHeight: 200
  119. anchors.fill: parent
  120. clip: true
  121. ScrollBar.vertical: ScrollBar {}
  122. boundsBehavior: Flickable.StopAtBounds
  123. highlightMoveVelocity: -1
  124. highlightMoveDuration: 1
  125. highlightFollowsCurrentItem: true
  126. keyNavigationEnabled: true
  127. delegate: ItemDelegate {
  128. width: ListView.view.width
  129. highlighted: ListView.isCurrentItem
  130. onClicked: () => fontStyleListView.currentIndex = index
  131. text: modelData
  132. }
  133. }
  134. }
  135. }
  136. ColumnLayout {
  137. spacing: 0
  138. Layout.preferredWidth: 20
  139. Label {
  140. text: qsTr("Size")
  141. Layout.alignment: Qt.AlignLeft
  142. }
  143. TextField {
  144. id: fontSizeEdit
  145. objectName: "sizeEdit"
  146. Layout.fillWidth: true
  147. validator: IntValidator {
  148. bottom: 1
  149. top: 512
  150. }
  151. }
  152. Frame {
  153. Layout.fillWidth: true
  154. Layout.fillHeight: true
  155. background: Rectangle {
  156. color: "white"
  157. }
  158. ListView {
  159. id: fontSizeListView
  160. objectName: "sizeListView"
  161. implicitHeight: 200
  162. anchors.fill: parent
  163. clip: true
  164. ScrollBar.vertical: ScrollBar {
  165. policy: ScrollBar.AlwaysOn
  166. }
  167. boundsBehavior: Flickable.StopAtBounds
  168. highlightMoveVelocity: -1
  169. highlightMoveDuration: 1
  170. highlightFollowsCurrentItem: true
  171. keyNavigationEnabled: true
  172. delegate: ItemDelegate {
  173. width: ListView.view.width
  174. highlighted: ListView.isCurrentItem
  175. onClicked: () => fontSizeListView.currentIndex = index
  176. text: modelData
  177. }
  178. }
  179. }
  180. }
  181. ColumnLayout {
  182. Layout.preferredWidth: 80
  183. GroupBox {
  184. id: effectsGroupBox
  185. title: qsTr("Effects")
  186. Layout.fillWidth: true
  187. Layout.fillHeight: true
  188. label: Label {
  189. anchors.left: effectsGroupBox.left
  190. text: parent.title
  191. }
  192. RowLayout {
  193. anchors.fill: parent
  194. CheckBox {
  195. id: fontUnderline
  196. objectName: "underlineEffect"
  197. text: qsTr("Underline")
  198. }
  199. CheckBox{
  200. id: fontStrikeout
  201. objectName: "strikeoutEffect"
  202. text: qsTr("Strikeout")
  203. }
  204. }
  205. }
  206. }
  207. GroupBox {
  208. id: sample
  209. padding: label.implicitHeight
  210. title: qsTr("Sample")
  211. Layout.fillWidth: true
  212. Layout.preferredWidth: 80
  213. Layout.fillHeight: true
  214. Layout.columnSpan: 2
  215. clip: true
  216. background: Rectangle {
  217. y: sample.topPadding - sample.bottomPadding
  218. width: sample.width - sample.leftPadding + sample.rightPadding
  219. height: sample.height - sample.topPadding + sample.bottomPadding
  220. radius: 3
  221. }
  222. label: Label {
  223. anchors.left: sample.left
  224. text: sample.title
  225. }
  226. TextEdit {
  227. id: fontSample
  228. objectName: "sampleEdit"
  229. anchors.centerIn: parent
  230. readOnly: true
  231. }
  232. }
  233. }