Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Problems using MouseArea inside a delegate of a Repeater - ends up 1 pixel tall!

$
0
0
The mistake is that in your delegate you are using anchors.fill from the rect to the parent item with margins of 8. Since you calculate the total size of the item to be the same as the text rect and then anchor the text item inside that with 8 pixel borders, you are shrinking the size of your mouse area by 8 pixels in all directions. Here is a simplified delegate that should work better:             delegate: Rectangle {                 color: "red"                 width: textBlock.paintedWidth + 10                 height: textBlock.paintedHeight                 Text {                     id: textBlock                     text: name                     font.pixelSize: 20                     anchors.centerIn: parent                 }                 MouseArea {                     anchors.fill: parent                     hoverEnabled: true                     onEntered: { console.log("entered") }                 }             }

Viewing all articles
Browse latest Browse all 4972

Trending Articles