file:///home/biergaizi/WeCase.commit/src//ui/SmileyDelegate.qml:6:5:
QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn
anchors for items inside Column
Why I got that? I tried to comment each line without find answer. I do not have any idea with it.
SmileyView.qml
import QtQuick 1.0
Rectangle {
width: 300; height: 200
GridView {
id: grid
anchors.fill: parent
cellWidth: 36; cellHeight: 40
model: SmileyModel
delegate: SmileyDelegate {}
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
focus: true
}
}
SmileyDelegate.qml
import QtQuick 1.0
Item {
width: grid.cellWidth; height: grid.cellHeight
Column {
anchors.fill: parent
Image { source: path; anchors.horizontalCenter: parent.horizontalCenter }
Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
MouseArea {
anchors.fill: parent
onClicked: {
highlight: color: "lightsteelblue"; radius: 5
grid.currentIndex = index
}
onDoubleClicked: {
parentWindow.returnSmileyName('[' + name + ']')
}
}
}
}
Column is trying to anchor your MouseArea to next to the Image and the Text, but the MouseArea specifies its anchor to fill its parent. Those two things are contradictory, and hence why you get the error.
You'll probably find it works as you expect if you move the MouseArea out of Column and into the base Item for SmileyDelegate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With