Home > other >  Qml small white for help! About the OnClicked and OnEntered events
Qml small white for help! About the OnClicked and OnEntered events

Time:10-25

Qml small white for help: -) disturb the kagyu wow
Want to implement a function, that is, click on the Button, the Button that corresponds to the Image into blue, the rest are white; When the mouse moved to the Button above, if the Image is blue, not executed if statements specified operation, otherwise become gray; When the mouse left Button, if the Image is blue, not executed if statements specified operation, otherwise become white,
But after execution, although the Image is blue, the mouse moved to the Button above or leave the Button will change the color of the Image (i.e., ignoring the if limitations),
The following is the function of the corresponding code:
 
The Button {
Anchors. The fill: parent
HoverEnabled: true
Background: transparent

ToolTip. Visible: hovered
ToolTip text: qsTr (" strip line ")

Image {
Id: stripCourseImage
Z: 5
Width: stripCourseBtn. Width * 0.4
Height: stripCourseBtn. Height * 0.4
Mipmap: true
Anchors. CenterIn: parent
Source: "Images/paper plane - the fill white. SVG"
}

MouseArea {
Anchors. The fill: parent
HoverEnabled: true

OnClicked: {
WayPointFlightImage. Source="Images/paper plane - the fill white. SVG"
AerialPhotographyImage. Source="Images/paper plane - the fill white. SVG"
ObliquePhotographyImage. Source="Images/paper plane - the fill white. SVG"
StripCourseImage. Source="Images/paper plane - the fill blue. SVG"
}

OnEntered: {
If (wayPointFlightImage source!="Images/paper plane - the fill blue. SVG") {
WayPointFlightImage. Source="Images/paper plane - the fill white. SVG"
}
If (aerialPhotographyImage source!="Images/paper plane - the fill blue. SVG") {
AerialPhotographyImage. Source="Images/paper plane - the fill white. SVG"
}
If (obliquePhotographyImage source!="Images/paper plane - the fill blue. SVG") {
ObliquePhotographyImage. Source="Images/paper plane - the fill white. SVG"
}
If (stripCourseImage source!="Images/paper plane - the fill blue. SVG") {
StripCourseImage. Source="Images/paper plane - the fill grey. The SVG"
}
}

OnExited: {
If (stripCourseImage source!="Images/paper plane - the fill blue. SVG") {
StripCourseImage. Source="Images/paper plane - the fill white. SVG"
}
}
}
}

  • Related