T_Buttons.qml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Window
  4. import QtQuick.Controls
  5. import QtQuick.Controls.Basic
  6. import FluentUI
  7. import "../component"
  8. FluScrollablePage{
  9. title:"Buttons"
  10. leftPadding:10
  11. rightPadding:10
  12. bottomPadding:20
  13. spacing: 0
  14. FluText{
  15. Layout.topMargin: 20
  16. text:"支持Tab键切换焦点,空格键执行点击事件"
  17. }
  18. FluArea{
  19. Layout.fillWidth: true
  20. height: 68
  21. paddings: 10
  22. Layout.topMargin: 20
  23. FluTextButton{
  24. disabled:text_button_switch.selected
  25. text:"Text Button"
  26. onClicked: {
  27. showInfo("点击Text Button")
  28. }
  29. anchors{
  30. verticalCenter: parent.verticalCenter
  31. left: parent.left
  32. }
  33. }
  34. Row{
  35. spacing: 5
  36. anchors{
  37. verticalCenter: parent.verticalCenter
  38. right: parent.right
  39. }
  40. FluToggleSwitch{
  41. id:text_button_switch
  42. Layout.alignment: Qt.AlignRight
  43. text:"Disabled"
  44. }
  45. }
  46. }
  47. CodeExpander{
  48. Layout.fillWidth: true
  49. Layout.topMargin: -1
  50. code:'FluTextButton{
  51. text:"Text Button"
  52. onClicked: {
  53. }
  54. }'
  55. }
  56. FluArea{
  57. Layout.fillWidth: true
  58. height: 68
  59. paddings: 10
  60. Layout.topMargin: 20
  61. FluButton{
  62. disabled:button_switch.selected
  63. text:"Standard Button"
  64. onClicked: {
  65. showInfo("点击StandardButton")
  66. }
  67. anchors{
  68. verticalCenter: parent.verticalCenter
  69. left: parent.left
  70. }
  71. }
  72. Row{
  73. spacing: 5
  74. anchors{
  75. verticalCenter: parent.verticalCenter
  76. right: parent.right
  77. }
  78. FluToggleSwitch{
  79. id:button_switch
  80. Layout.alignment: Qt.AlignRight
  81. text:"Disabled"
  82. }
  83. }
  84. }
  85. CodeExpander{
  86. Layout.fillWidth: true
  87. Layout.topMargin: -1
  88. code:'FluButton{
  89. text:"Standard Button"
  90. onClicked: {
  91. }
  92. }'
  93. }
  94. FluArea{
  95. Layout.fillWidth: true
  96. height: 68
  97. Layout.topMargin: 20
  98. paddings: 10
  99. FluFilledButton{
  100. disabled:filled_button_switch.selected
  101. text:"Filled Button"
  102. onClicked: {
  103. showWarning("点击FilledButton")
  104. }
  105. anchors{
  106. verticalCenter: parent.verticalCenter
  107. left: parent.left
  108. }
  109. }
  110. Row{
  111. spacing: 5
  112. anchors{
  113. verticalCenter: parent.verticalCenter
  114. right: parent.right
  115. }
  116. FluToggleSwitch{
  117. id:filled_button_switch
  118. Layout.alignment: Qt.AlignRight
  119. text:"Disabled"
  120. }
  121. }
  122. }
  123. CodeExpander{
  124. Layout.fillWidth: true
  125. Layout.topMargin: -1
  126. code:'FluFilledButton{
  127. text:"Filled Button"
  128. onClicked: {
  129. }
  130. }'
  131. }
  132. FluArea{
  133. Layout.fillWidth: true
  134. height: 68
  135. Layout.topMargin: 20
  136. paddings: 10
  137. FluToggleButton{
  138. disabled:toggle_button_switch.selected
  139. text:"Toggle Button"
  140. onClicked: {
  141. selected = !selected
  142. }
  143. anchors{
  144. verticalCenter: parent.verticalCenter
  145. left: parent.left
  146. }
  147. }
  148. Row{
  149. spacing: 5
  150. anchors{
  151. verticalCenter: parent.verticalCenter
  152. right: parent.right
  153. }
  154. FluToggleSwitch{
  155. id:toggle_button_switch
  156. Layout.alignment: Qt.AlignRight
  157. text:"Disabled"
  158. }
  159. }
  160. }
  161. CodeExpander{
  162. Layout.fillWidth: true
  163. Layout.topMargin: -1
  164. code:'FluToggleButton{
  165. text:"Toggle Button"
  166. onClicked: {
  167. selected = !selected
  168. }
  169. }'
  170. }
  171. FluArea{
  172. Layout.fillWidth: true
  173. height: 68
  174. paddings: 10
  175. Layout.topMargin: 20
  176. FluIconButton{
  177. iconSource:FluentIcons.ChromeCloseContrast
  178. disabled:icon_button_switch.selected
  179. iconSize: 15
  180. anchors{
  181. verticalCenter: parent.verticalCenter
  182. left: parent.left
  183. }
  184. onClicked:{
  185. showSuccess("点击IconButton")
  186. }
  187. }
  188. Row{
  189. spacing: 5
  190. anchors{
  191. verticalCenter: parent.verticalCenter
  192. right: parent.right
  193. }
  194. FluToggleSwitch{
  195. id:icon_button_switch
  196. Layout.alignment: Qt.AlignRight
  197. text:"Disabled"
  198. }
  199. }
  200. }
  201. CodeExpander{
  202. Layout.fillWidth: true
  203. Layout.topMargin: -1
  204. code:'FluIconButton{
  205. iconSource:FluentIcons.ChromeCloseContrast
  206. onClicked: {
  207. }
  208. }'
  209. }
  210. FluArea{
  211. Layout.fillWidth: true
  212. height: 68
  213. paddings: 10
  214. Layout.topMargin: 20
  215. FluDropDownButton{
  216. disabled:drop_down_button_switch.selected
  217. text:"DropDownButton"
  218. anchors{
  219. verticalCenter: parent.verticalCenter
  220. left: parent.left
  221. }
  222. items:[
  223. FluMenuItem{
  224. text:"Menu_1"
  225. },
  226. FluMenuItem{
  227. text:"Menu_2"
  228. },
  229. FluMenuItem{
  230. text:"Menu_3"
  231. },
  232. FluMenuItem{
  233. text:"Menu_4"
  234. }
  235. ]
  236. }
  237. Row{
  238. spacing: 5
  239. anchors{
  240. verticalCenter: parent.verticalCenter
  241. right: parent.right
  242. }
  243. FluToggleSwitch{
  244. id:drop_down_button_switch
  245. Layout.alignment: Qt.AlignRight
  246. text:"Disabled"
  247. }
  248. }
  249. }
  250. CodeExpander{
  251. Layout.fillWidth: true
  252. Layout.topMargin: -1
  253. code:'FluDropDownButton{
  254. text:"DropDownButton"
  255. items:[
  256. FluMenuItem{
  257. text:"Menu_1"
  258. },
  259. FluMenuItem{
  260. text:"Menu_2"
  261. },
  262. FluMenuItem{
  263. text:"Menu_3"
  264. },
  265. FluMenuItem{
  266. text:"Menu_4"
  267. }
  268. ]
  269. }'
  270. }
  271. FluArea{
  272. Layout.fillWidth: true
  273. height: 100
  274. paddings: 10
  275. Layout.topMargin: 20
  276. ColumnLayout{
  277. spacing: 8
  278. anchors{
  279. verticalCenter: parent.verticalCenter
  280. left: parent.left
  281. }
  282. Repeater{
  283. id:repeater
  284. property int selecIndex : 0
  285. model: 3
  286. delegate: FluRadioButton{
  287. selected : repeater.selecIndex===index
  288. disabled:radio_button_switch.selected
  289. text:"Radio Button_"+index
  290. onClicked:{
  291. repeater.selecIndex = index
  292. }
  293. }
  294. }
  295. }
  296. Row{
  297. spacing: 5
  298. anchors{
  299. verticalCenter: parent.verticalCenter
  300. right: parent.right
  301. }
  302. FluToggleSwitch{
  303. id:radio_button_switch
  304. Layout.alignment: Qt.AlignRight
  305. text:"Disabled"
  306. }
  307. }
  308. }
  309. CodeExpander{
  310. Layout.fillWidth: true
  311. Layout.topMargin: -1
  312. code:'FluRadioButton{
  313. selected:true
  314. text:"Text Button"
  315. onClicked: {
  316. }
  317. }'
  318. }
  319. FluArea{
  320. Layout.fillWidth: true
  321. height: 68
  322. paddings: 10
  323. Layout.topMargin: 20
  324. FluCheckBox{
  325. disabled:check_box_switch.selected
  326. text:"Check Box"
  327. anchors{
  328. verticalCenter: parent.verticalCenter
  329. left: parent.left
  330. }
  331. }
  332. Row{
  333. spacing: 5
  334. anchors{
  335. verticalCenter: parent.verticalCenter
  336. right: parent.right
  337. }
  338. FluToggleSwitch{
  339. id:check_box_switch
  340. Layout.alignment: Qt.AlignRight
  341. text:"Disabled"
  342. }
  343. }
  344. }
  345. CodeExpander{
  346. Layout.fillWidth: true
  347. Layout.topMargin: -1
  348. code:'FluCheckBox{
  349. text:"Check Box"
  350. }'
  351. }
  352. }