[Interest] ListView text item delegate property setting issue

Nils Jeisecke njeisecke at saltation.de
Fri Mar 8 09:43:28 CET 2013


Hi,

On Fri, Mar 8, 2013 at 1:41 AM, Steve Pavao <vstevenpavao at yahoo.com> wrote:
> The problem I am having is that I haven't found a reliable way to be able to set the
> associated text delegate's font.bold and font.pixelSize properties once I set the
> ListView's currentIndex to that desired value
> programatically.  (I want the text for the item at the currentIndex to show in bold
> and at a larger pixelSize).

Doesn't this pattern work for you?

import QtQuick 1.1

Rectangle {
  width: 360
  height: 360
  ListView {
    anchors.fill: parent
    model: 10
    delegate: Text {
      id: delegate
      font.bold: model.index === delegate.ListView.view.currentIndex
      font.pixelSize: model.index ===
delegate.ListView.view.currentIndex ? 20 : 16
      text: modelData
      MouseArea {
        anchors.fill: parent
        onClicked: delegate.ListView.view.currentIndex = model.index
      }
    }
  }
}



More information about the Interest mailing list