QML MouseArea
-
Thank you very much.Could you please tell me in an example
-
Within a mouseArea how will we add text concept..I have tried it out,but it is showing error..Please help me
-
Show me your code, then. Do you expect me to write your app for you?
A quick example:
@
Image {
id: yourImageMouseArea {
id: mouseArea
hoverEnabled: true
anchors.fill: parentonEntered: myText.visible = true; onExited: myText.visible = false;
}
Text {
id: myText
// [...]
}
}
@ -
@import QtQuick 1.0
Image{
width:1300
height:800
id:original
source:"img/originalblue.png"
anchors.fill:parent
Image{
id:view
width:350
height:60
source:"img/g5.png"
anchors.top:parent.top
anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
Text {
id: view1
text: qsTr("View/Modify Speciality")
font.pixelSize: 30
anchors.centerIn: parent
}
}
Image{
id:delete1
source:"img/deleticon.png"
width:80
height:80
anchors.left:parent.left
anchors.leftMargin: 70
anchors.bottom:parent.bottom
anchors.bottomMargin: 60
MouseArea{
id:del
hoverEnabled: true
anchors.fill:parent
onEntered:
{
delete1.width=80
delete1.height=100
}
onExited:
{
delete1.width=80
delete1.height=80
}
}
}
}@ -
Use '@' tags and format your code so that it's readable.
You just need to anchor the Text element properly (like anchors.bottom: parent.bottom) and it will work.
-
boss i just need to know,can we use text inside the mouse event....
-
when i enters the deleticon.png , i want to show the delete name below the deleticon..please tell me in code.i will be so much thankful to you
-
Yes, I have already shown you how in my first snippet.
-
@
Text {
id: view2
text: qsTr("Delete")
font.pixelSize: 30
anchors.top: delete1.bottom
anchors.horizontalCenter: delete1.horizontalCenter
}
@ -
Thank you very much bosss...Almost its worked...
With regards,
mohanakannan