Unable to assign QQuickAnchorLine to int
Solved
QML and Qt Quick
-
Hi,
This simple QML program produces the errorUnable to assign QQuickAnchorLine to int
import QtQuick 2.0 Rectangle { id: root visible: true width: 800 height: 480 color: "lightsteelblue" gradient: Gradient { GradientStop { position: 0.0; color: "lightsteelblue" } GradientStop { position: 1.0; color: "blue" } } Image { id: image1 horizontalAlignment:Image.AlignHCenter verticalAlignment:Image.AlignVCenter width: 250 height: 250 source: "logo_white_text.png" } }
What is this error??? The image displays, but does not get centered as planned?
Thanks!
-
Hi! Alignment is important together with
fillMode
. What you want to achieve is to center the image in the rectangle. This is done with:anchors.centerIn: parent
. -
@Wieland
Thanks, that was quick!Before I posted this message, I had a look at the
http://doc.qt.io/qt-5/qml-qtquick-image-members.html
page and found no anchors members, so was lost.Of course, I forgot to look at all the inherited members...
My bad!Thanks again @Wieland !