TableView Model



  • Hi

    I have created a tableview with alternative Rows color. Then I needed to change the font size of the text in Row.

    I have inserted these changes to get the font size changes.
    itemDelegate: Recatangle{
    Text{
    font.pixelSize: 35
    }
    }

    This helped and font size has changed, but my alternative Rows color has vanished.

    My question is.

    1. How can I change the size of font and Row size without losing control on AlternativeRows color.
    2. Also how can I control which color is to be displayed for Alternative Rows color.

  • Moderators

    @Fehan-Arif
    Once you set your custom delegate the default style is overridden.

    How can I change the size of font and Row size without losing control on AlternativeRows color.

    You will manually need to set those colors. For eg:

    itemDelegate: Recatangle{
    color: styleData.row%2==0? "red" : "lightgray"
    Text{
          font.pixelSize: 35
       }
    }
    

    http://doc.qt.io/qt-5/qml-qtquick-controls-tableview.html#itemDelegate-prop

    Also how can I control which color is to be displayed for Alternative Rows color.

    Shown in above code.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.