Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75307

Inconsistent deprecation of QModelIndex methods

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.13.0 Beta2
    • Core: Item Models
    • None
    • Kubuntu 18.10, 64 bit

    Description

      The QModelIndex::child(int row, int column) const was deprecated some time ago but only in 5.13 stated to produce build warnings.
      This deprecation is very troubling since there is no direct replacement, keeping pointer to the model is not always feasible and obtaining it using QModelIndex::model() requires checking if it is valid, both methods add a lot of duplicated code to silence it or dummy helper function that does exactly the same thing as this method does in the first place...
      What is the point of deprecating it, since there is no obvious gain from doing so and it only forces pointless code churn?
      Also, similar method, QModelIndex::sibling() const, is left as is (and even better, it got two friends in 5.11: QModelIndex::siblingAtColumn() const and QModelIndex::siblingAtRow() const), while both are like twins, making the same sense to exist or not, making this deprecation ridiculous.
      Moreover, it breaks documentation of this class:
      The model() function returns the model that the index references as a QAbstractItemModel. The child() function is used to examine items held under the index in the model. The sibling() function allows you to traverse items in the model on the same level as the index.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            peppe Giuseppe D'Angelo
            emdek MichaƂ Dutkiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes