Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Clarification needed: QModelIndexList QItemSelectionModel::selectedRows ( int column = 0 ) const



  • Can someone please clarify what this means?

    How does the description of this method change for selectedRows( 0); and selectedRows( 1); ?
    How can it be "all columns" when your column parameter is 0 or 1?

    bq. QModelIndexList QItemSelectionModel::selectedRows ( int column = 0 ) const
    Returns the indexes in the given column for the rows where all columns are selected.
    This function was introduced in Qt 4.2.
    See also selectedIndexes() and selectedColumns().


  • Lifetime Qt Champion

    Hi,

    I think you are mixing two things. The column parameter here allows you to select where the indexes will come from e.g. selectedRows(1) will give you the indexes of (0, 1) (1, 1) and (3,1) if you have rows 0 ,1 and 3 completely selected. If you call it with the default value you would have had the indexes of (0,0), (1,0) and (3,0)

    (x, y) beeing (row, col) index address

    Hope it helps



  • Ah, thank you. Now I get it.


  • Lifetime Qt Champion

    You're welcome !

    Since it's all okay, please update the thread title prepending [solved] so other forum users may know an answer has been found :)


Log in to reply