[Interest] QtQuickControls Layout Question

Daiwei Li daiweili at gmail.com
Fri Jun 7 23:55:10 CEST 2013


Hello all,

I'm having some trouble understanding what happens with the following QML:

import QtQuick 2.1

import QtQuick.Layouts 1.0


Item {

    width: 320

    height: 240

    ColumnLayout {

        anchors.left: parent.left

        anchors.right: parent.right

        RowLayout {

            Layout.fillWidth: true

            Text { text: 'foo' }

            Text { text: 'bar'; Layout.alignment: Qt.AlignRight }

        }

    }

}


I would expect the above code to look like good.png, but instead it looks
like bad.png. If I get rid of the ColumnLayout and do the following, it
works fine:


import QtQuick 2.1

import QtQuick.Layouts 1.0

Item {

    width: 320

    height: 240

    RowLayout {

        anchors.left: parent.left

        anchors.right: parent.right

        Text { text: 'foo' }

        Text { text: 'bar'; Layout.alignment: Qt.AlignRight }

    }

}


I'm able to work around the problem by putting a Layout.fillWidth: true in
'foo' in the first snippet, but I feel like I shouldn't need to do that.

Does anyone know what I'm doing wrong in the first example, or if it's a
bug with QtQuickControls layouts?

Thanks,
Daiwei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130607/ec71f297/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: good.png
Type: image/png
Size: 6181 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130607/ec71f297/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad.png
Type: image/png
Size: 6193 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130607/ec71f297/attachment-0001.png>


More information about the Interest mailing list