Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Plan for QAbstractItemModel::span ?
Forum Updated to NodeBB v4.3 + New Features

Plan for QAbstractItemModel::span ?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 6.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashwindas
    wrote on last edited by
    #1

    In the documentation of QAbstractItemModel, I can find this:

    QSize QAbstractItemModel::span ( const QModelIndex & index ) const [virtual]
    Returns the row and column span of the item represented by index.
    Note: Currently, span is not used.

    Currently to achieve span in QTableView I am using
    void QTableView::setSpan ( int row, int column, int rowSpanCount, int columnSpanCount )

    but this is not the right way, as this has to be done from the model,
    Doing on the view, I have to handle the span when the rows are sorted or columns moved around, as the span remains in the same place, but the data moves around.

    To ensure that the span is linked to the data it was meant to be for, it has to come from the model.

    Is there anyway to achieve span, wherein the span moves when sorted or filter etc, with the data.
    When is the plan to implement the span method in QAbstractItemModel?

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      see this bug: "http://bugreports.qt.nokia.com/browse/QTBUG-6508":http://bugreports.qt.nokia.com/browse/QTBUG-6508

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ashwindas
        wrote on last edited by
        #3

        @chetankjain: thanks for the update

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          ashwin, wanna try implementing the span() method in QAbstractItemModel? :)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            chetan: that would be easy :-)

            @
            return QSize(1,1);
            @

            That's what the view classes assume at the moment. QTreeView could ignore the setting (as it does not support spans today). But the table view classes would definitely profit from it. I missed it too.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jc-denton
              wrote on last edited by
              #6

              Hrmm the last entry from the bug report is from 2009 :( In Qt 4.8 the docs for QAbstractItemModel (why don't they put it in QAbstractTableModel??) still says:

              @QSize QAbstractItemModel::span ( const QModelIndex & index ) const [virtual]
              Returns the row and column span of the item represented by index.
              Note: Currently, span is not used.@

              So I guess I have to work around this.. what's the best way?

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jc-denton
                wrote on last edited by
                #7

                What about extending QTableView and then implement span(..)? I haven't extended any QtView class so far..

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved