T_MultiWindow.qml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Window
  4. import QtQuick.Controls
  5. import FluentUI
  6. import "../component"
  7. FluScrollablePage{
  8. property string password: ""
  9. property var loginPageRegister: registerForWindowResult("/login")
  10. title:"MultiWindow"
  11. leftPadding:10
  12. rightPadding:10
  13. bottomPadding:20
  14. spacing: 0
  15. Connections{
  16. target: loginPageRegister
  17. function onResult(data)
  18. {
  19. password = data.password
  20. }
  21. }
  22. FluArea{
  23. Layout.fillWidth: true
  24. height: 86
  25. paddings: 10
  26. Layout.topMargin: 20
  27. Column{
  28. spacing: 15
  29. anchors{
  30. verticalCenter: parent.verticalCenter
  31. left: parent.left
  32. }
  33. FluText{
  34. text:"<font color='red'>Standard</font>模式窗口,每次都会创建新窗口"
  35. }
  36. FluButton{
  37. text:"点击创建窗口"
  38. onClicked: {
  39. FluApp.navigate("/standardWindow")
  40. }
  41. }
  42. }
  43. }
  44. FluArea{
  45. Layout.fillWidth: true
  46. height: 86
  47. paddings: 10
  48. Layout.topMargin: 10
  49. Column{
  50. spacing: 15
  51. anchors{
  52. verticalCenter: parent.verticalCenter
  53. left: parent.left
  54. }
  55. FluText{
  56. text:"<font color='red'>SingleTask</font>模式窗口,如果窗口存在,这激活该窗口"
  57. textFormat: Text.RichText
  58. }
  59. FluButton{
  60. text:"点击创建窗口"
  61. onClicked: {
  62. FluApp.navigate("/singleTaskWindow")
  63. }
  64. }
  65. }
  66. }
  67. FluArea{
  68. Layout.fillWidth: true
  69. height: 86
  70. paddings: 10
  71. Layout.topMargin: 10
  72. Column{
  73. spacing: 15
  74. anchors{
  75. verticalCenter: parent.verticalCenter
  76. left: parent.left
  77. }
  78. FluText{
  79. text:"<font color='red'>SingleInstance</font>模式窗口,如果窗口存在,则销毁窗口,然后新建窗口"
  80. }
  81. FluButton{
  82. text:"点击创建窗口"
  83. onClicked: {
  84. FluApp.navigate("/singleInstanceWindow")
  85. }
  86. }
  87. }
  88. }
  89. CodeExpander{
  90. Layout.fillWidth: true
  91. Layout.topMargin: -1
  92. code:'FluWindow{
  93. //launchMode: FluWindow.Standard
  94. //launchMode: FluWindow.SingleTask
  95. launchMode: FluWindow.SingleInstance
  96. }
  97. '
  98. }
  99. FluArea{
  100. Layout.fillWidth: true
  101. height: 100
  102. paddings: 10
  103. Layout.topMargin: 20
  104. Column{
  105. spacing: 15
  106. anchors{
  107. verticalCenter: parent.verticalCenter
  108. left: parent.left
  109. }
  110. FluText{
  111. text:"页面跳转,不携带任何参数"
  112. }
  113. FluButton{
  114. text:"点击跳转"
  115. onClicked: {
  116. FluApp.navigate("/about")
  117. }
  118. }
  119. }
  120. }
  121. CodeExpander{
  122. Layout.fillWidth: true
  123. Layout.topMargin: -1
  124. code:'FluButton{
  125. text:"点击跳转"
  126. onClicked: {
  127. FluApp.navigate("/about")
  128. }
  129. }
  130. '
  131. }
  132. FluArea{
  133. Layout.fillWidth: true
  134. height: 130
  135. paddings: 10
  136. Layout.topMargin: 20
  137. Column{
  138. spacing: 15
  139. anchors{
  140. verticalCenter: parent.verticalCenter
  141. left: parent.left
  142. }
  143. FluText{
  144. text:"页面跳转,并携带参数用户名:zhuzichu"
  145. }
  146. FluButton{
  147. text:"点击跳转到登录"
  148. onClicked: {
  149. loginPageRegister.launch({username:"zhuzichu"})
  150. }
  151. }
  152. FluText{
  153. text:"登录窗口返回过来的密码->"+password
  154. }
  155. }
  156. }
  157. CodeExpander{
  158. Layout.fillWidth: true
  159. Layout.topMargin: -1
  160. code:'property var loginPageRegister: registerForWindowResult("/login")
  161. Connections{
  162. target: loginPageRegister
  163. function onResult(data)
  164. {
  165. password = data.password
  166. }
  167. }
  168. FluButton{
  169. text:"点击跳转"
  170. onClicked: {
  171. loginPageRegister.launch({username:"zhuzichu"})
  172. }
  173. }
  174. '
  175. }
  176. }