Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

positioning with layouts revisited



  • Hi all -

    (Similar but not identical to another post I made a few weeks back.)

    I'm trying to use layouts, but they seem to interfere with various attempts to position/contain items within them. For example, This code:

    ColumnLayout {
      width: root.width * 0.8
      x: (parent.width - width) / 2
      y: 40
    
      Repeater {
        RunSynthStepSummary {
      ...
    

    RunSynthStepSummary.qml:

    ColumnLayout {
    id: root
    width: parent.width
    
    //  Item {
    //   height: parent.height
    //   width: parent.width
    
      Text {
      Layout.topMargin: 10
      width: root.width
      wrapMode: Text.WordWrap
      text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut augue elit, "
       + "pharetra dignissim nisi ac, vulputate lobortis turpis. "
      }
    

    produces this:
    no_item.PNG

    As you can see, the text isn't wrapping.

    Question 1: why isn't the text wrapping? I believe I have all the necessary width settings.

    If I uncomment the "Item" around the Text, I get this:
    with_item.PNG
    So, I'm getting the wrapping I want, but now I somehow need to properly set the height property of the containing ColumnLayout (I think).

    Question 2: how do I do this?

    Thanks...


Log in to reply