Why is QAbstractListModel::columnCount() private?

  • Hi an thanks for reading!

    The title says everything.. I'm using QAbstractListModel and I get error when I try to call columnCount() because it is private. I know I can just cast it to QAbstractItemModel, but I'm wondering why it is private.

    Thank you!

  • Probably because QAbstractListModel is a 1-dimensional container, so rowCount tells you how many items are in it but columnCount would logically always be 1. It's probably private to prevent you from using it accidentally thinking you were getting rowCount (the number of items in the container).

  • That's a good reason.. I was using it just to be prepared in case I don't use QAbstractListModel anymore, but I was curious about this..

    Thank you!

Log in to reply

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