Results 1 to 6 of 6

Thread: clearSpans() for selected spans

  1. #1
    Join Date
    Mar 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default clearSpans() for selected spans

    Hi all!

    clearSpans() in QTableView - removes all row and column spans in the table view.
    How I can remove only selected spans?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: clearSpans() for selected spans

    Does calling setSpan(row, column, 1, 1) on the span you want to remove work?

  3. #3
    Join Date
    Mar 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: clearSpans() for selected spans

    Quote Originally Posted by ChrisW67 View Post
    Does calling setSpan(row, column, 1, 1) on the span you want to remove work?
    Yes, it works...
    but if I have selection, I can`t del span by this method (only using 'brute force of loop').
    So, I think the best way - just clear all spans and rebuild it again without selected.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: clearSpans() for selected spans

    Why are you trying so hard to avoid looping over the cells in the selection, determining which ones are the top-leftmost in spanned cells, and resetting those? It seems your alternate is to iterate the entire to table to find which items are the top-leftmost item in a spanned area, storing those somewhere, clear all spans, then reinstate all the stored spans except those that would fall inside the selection. Perhaps I don't understand.

  5. #5
    Join Date
    Mar 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: clearSpans() for selected spans

    Quote Originally Posted by ChrisW67 View Post
    Why are you trying so hard
    Good question.
    This is because I have additional structure storing the spans. I don't need iterate entire table. So, rebuilding - wery simple for me, may be not most efficient, but simple.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: clearSpans() for selected spans

    Fair enough. That helps

Similar Threads

  1. Replies: 0
    Last Post: 20th April 2010, 04:39
  2. Replies: 0
    Last Post: 13th August 2009, 14:51
  3. Getting the selected row
    By k12yp70n in forum Newbie
    Replies: 4
    Last Post: 4th June 2009, 16:01
  4. Replies: 0
    Last Post: 9th February 2009, 20:57
  5. Replies: 1
    Last Post: 23rd December 2008, 15:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.