SGbo
SGbo

Reputation: 344

QML Listview header from QAbstractListmodel headerData()

I'm exposing many QAbstractListModels to QML Listview (Qt4.8.2 QML 1.1). My problem is now, that the QML ListView is ignoring the headerData() function of my ListModels. I was looking for a solution for more than four hours now.

I'm thinking that I have to implement my own Q_INVOKABLE function to realize this.

Please let me know if there is a way to implement the headerData() function!

Thanks in advance.

Upvotes: 2

Views: 1450

Answers (1)

Kevin Krammer
Kevin Krammer

Reputation: 5207

A QtQuick ListView doesn't have any header item, so it doesn't need headerData() in its normal operation.

If you have added an item that serves as a header and want the model to provide the string, you can either indeed make the headerData() method Q_INVOKABLE or add a Q_PROPERTY for that value.

Upvotes: 2

Related Questions