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. QAbstractItemModel::Span
Forum Updated to NodeBB v4.3 + New Features

QAbstractItemModel::Span

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.5k 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.
  • M Offline
    M Offline
    mlucool
    wrote on last edited by
    #1

    Hi,

    I would like to use:
    http://doc.trolltech.com/4.7/qabstractitemmodel.html#span, but it says "Note: Currently, span is not used."

    I have looked into previous releases, and it seems that span has been unimplemented for a long time. Why is this the case? Is there any way around this if I want to add something that will span multiple columns?

    Thanks,
    Marc

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dfaure
      wrote on last edited by
      #2

      The API is there in QAbstractItemModel from the start (since it's virtual, it couldn't have been added at a later point), but indeed no views implement it.

      I used span() in KDReports (http://www.kdab.com/products/kd-reports), which creates tables in a report (using QTextDocument internally), in order to support spans.

      But as long as QTableView does not implement it, you don't really have a solution for a tableview. All you can do is vote on http://bugreports.qt.nokia.com/browse/QTBUG-6508 :-)

      David Faure (david.faure@kdab.com)
      KDE/Qt Senior Software Engineer
      KDAB - Qt Experts - Platform-independent software solutions

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dfaure
        wrote on last edited by
        #3

        Ah, I forgot: currently to achieve span in QTableView you can use:
        void QTableView::setSpan ( int row, int column, int rowSpanCount, int columnSpanCount )

        This is not as nice as having this information come from the model, but it's a way to get things done.

        Not available in a QTreeView though (you didn't specify which one you were using).

        David Faure (david.faure@kdab.com)
        KDE/Qt Senior Software Engineer
        KDAB - Qt Experts - Platform-independent software solutions

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlucool
          wrote on last edited by
          #4

          I am using a QTreeView, meaning this will not work for the column span I wanted. Thanks for your reply.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dfaure
            wrote on last edited by
            #5

            Ah OK, then it's rather http://bugreports.qt.nokia.com/browse/QTBUG-2117 that you want to vote for :-)

            David Faure (david.faure@kdab.com)
            KDE/Qt Senior Software Engineer
            KDAB - Qt Experts - Platform-independent software solutions

            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