Russian Qt Forum

Qt => Qt Quick => Тема начата: owner.coder от Августа 25, 2017, 10:20



Название: GridLayout и поционирование custom control
Отправлено: owner.coder от Августа 25, 2017, 10:20
Доброго времени суток!

Помогите разобраться в следующей проблеме.
Код:
Item {
    id: item1
    GridLayout {
        id: columnLayout
        rowSpacing: 5
        columns: 1
        anchors.fill: parent
        clip: false
        anchors.topMargin: Style.device.dp * 5
        rows: 5
        flow: GridLayout.TopToBottom
        Label {
            text: qsTr("Auth with social netowrks")
            font.pixelSize: Style.h2
            anchors.horizontalCenter: parent.horizontalCenter
        }
        Label {
            id: label
            text: qsTr("Auth with social networks")
            font.pixelSize: Style.h2
            anchors.horizontalCenter: parent.horizontalCenter
        }
        Devider {
            label: qsTr("Login")
        }
        Label {
            text: qsTr("Auth with social networks")
            font.pixelSize: Style.h2
            anchors.horizontalCenter: parent.horizontalCenter
        }
    }
}

Код Devider:
Код:
Column {
    spacing: Style.device.dp * 5
    width: parent.width
    property alias label: textLabel.text

    Rectangle {
        border.width: Style.device.dp * 1
        height: Style.device.dp * 2
        width: parent.width
        anchors.margins: Style.device.dp * 20
        border.color: Style.divider
    }
    Text {
        id: textLabel
        width: parent.width
        font.pixelSize: Style.h2
        color: Style.secondaryText
        horizontalAlignment: Text.AlignHCenter
        font.bold: true
    }
}

Проблема показана во вложении
(http://www.prog.org.ru/index.php?action=dlattach;topic=31565.0;attach=9191;image) (http://www.prog.org.ru/index.php?action=dlattach;topic=31565.0;attach=9190;image)


Название: Re: GridLayout и поционирование custom control
Отправлено: owner.coder от Августа 28, 2017, 07:09
Разобрался, у меня в родительском элементе не хватало anchors.fill: parent

Прошу закрыть!