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

Aligning ListView



  • I have this ListView, and I am trying to figure out how to align it from the right to the left without flipping the items in the list. Here is the code:

        ListView
        {
          anchors.left: label.right
          anchors.top: parent.top
          anchors.right: parent.right
          anchors.bottom: parent.bottom
          orientation: ListView.Horizontal
          width: parent.width
          anchors.rightMargin: control.style.rightPadding ? control.style.rightPadding : control.style.padding
          spacing: 5
          model: presentationManager.guidancePresenter.statusOptionsList
          delegate: IconButton
          {
            id: statusIconButton
            ...
        }
    

    Now when I add the following: LayoutDirection: Qt.RightToLeft it does align the list to the right side, but for some reason it flips the list so that the last item in the list is on the right instead of the left. Is there any way around this without reorganizing the items in the list?



  • hi
    Your issue is not very clear

    @RobM said in Aligning ListView:

    it does align the list to the right side,

    RowLayout{
     //   layoutDirection: Qt.RightToLeft   :  this will affect the order for the Button and the List, 
       Button{}
       ListView{
       //layoutDirection: Qt.RightToLeft  : this will affect the order of the items in the list
       }
    }
    

    i hope this helps


Log in to reply