Repeater resize problem
-
Hello,
I have rectangle and in this rectangle i have label. This rectangle height resizing with label contentHeight.
My codes here for this rectangle.
https://pastebin.com/eeaJm1E1I trying to do this for repeater with same codes but not working.
Codes here
https://pastebin.com/NtrYnQTCI tried get contentHeight of label but i getting 0 and i see text's without rectangle.
How can i fix this problem ? How can i resize hight of rectangle in repeater?
Thank you. -
Hello,
I have rectangle and in this rectangle i have label. This rectangle height resizing with label contentHeight.
My codes here for this rectangle.
https://pastebin.com/eeaJm1E1I trying to do this for repeater with same codes but not working.
Codes here
https://pastebin.com/NtrYnQTCI tried get contentHeight of label but i getting 0 and i see text's without rectangle.
How can i fix this problem ? How can i resize hight of rectangle in repeater?
Thank you.@jondoe hi
this works as expectedimport QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") property real msize: 12 Button{ onClicked: msize = 25 anchors.right: parent.right text: "change size" } ColumnLayout{ anchors.fill: parent Repeater{ model: 10 Rectangle { id: annenbe width: 200 height: testo.contentHeight border.width: 1 color: "red" onHeightChanged: console.log("size->", testo.contentHeight) Text{ id: testo color: "#ffffff" text: "text" wrapMode: Text.WrapAnywhere anchors.horizontalCenter: parent.horizontalCenter anchors.fill: parent font.weight: Font.DemiBold font.pixelSize: msize font.family: "Arial" } } } } }
-
@jondoe hi
this works as expectedimport QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") property real msize: 12 Button{ onClicked: msize = 25 anchors.right: parent.right text: "change size" } ColumnLayout{ anchors.fill: parent Repeater{ model: 10 Rectangle { id: annenbe width: 200 height: testo.contentHeight border.width: 1 color: "red" onHeightChanged: console.log("size->", testo.contentHeight) Text{ id: testo color: "#ffffff" text: "text" wrapMode: Text.WrapAnywhere anchors.horizontalCenter: parent.horizontalCenter anchors.fill: parent font.weight: Font.DemiBold font.pixelSize: msize font.family: "Arial" } } } } }
@lelev Not worked. http://prntscr.com/or8aqr
Your code working when u writing text yourself but i getting text from url so i guess i need change size after get text. -
@lelev Not worked. http://prntscr.com/or8aqr
Your code working when u writing text yourself but i getting text from url so i guess i need change size after get text.