鼠标操作使用很多,下面给出一个示例:

 1 import QtQuick 2.4
 2 import QtQuick.Controls 1.3
 3 import QtQuick.Window 2.2
 4 import QtQuick.Dialogs 1.2
 5 
 6 Rectangle{
 7     id: root
 8     width: 210
 9     height: 100
10 
11     Rectangle{
12         id: rect1
13         width: 100; height:100
14         color: "lightsteelblue"
15         MouseArea{
16             anchors.fill: parent
17 
18             onClicked: {
19                 rect2.visible = !rect2.visible
20                 console.log("visible: ", rect2.visible)
21             }
22         }
23     }
24 
25     Rectangle{
26         id: rect2
27         x:110; y:0
28         width: 100; height:100
29         color: "lightsteelblue"
30         border.color: "lightgreen"
31         border.width: 5
32         radius: 10
33     }
34 
35 }

 

相关文章:

  • 2021-10-25
  • 2021-05-22
  • 2022-01-01
  • 2021-12-26
  • 2021-09-06
  • 2018-06-20
  • 2021-11-01
  • 2021-07-13
猜你喜欢
  • 2022-02-10
  • 2022-01-04
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
相关资源
相似解决方案