2012-04-19 9 views
12

क्यूएमएल: माउसएरिया पर माउस पर ईवेंट को कैसे संभालें? क्या कोई साधारण उदाहरण प्रदान कर सकता है या कह सकता है कि मेरे साथ क्या गलत है?क्यूएमएल: माउस को कैसे संभालना है?

import QtQuick 1.1 
Image { 
    source: "quit.png" 
    scale: mouseArea.containsMouse ? 0.8 : 1.0 
    smooth: quitMouse.containsMouse 
    MouseArea { 
     id: quitMouse 
     anchors.fill: parent 
     anchors.margins: -10 
     onClicked: Qt.quit() 
    } 
} 

उत्तर

15
import QtQuick 1.1 
Image { 
    source: "quit.png" 
    scale: mouseArea.containsMouse ? 0.8 : 1.0 
    smooth: mouseArea.containsMouse 
    MouseArea { 
     id: mouseArea 
     anchors.fill: parent 
     anchors.margins: -10 
     hoverEnabled: true   //this line will enable mouseArea.containsMouse 
     onClicked: Qt.quit() 
    } 
} 
संबंधित मुद्दे