Results 1 to 2 of 2

Thread: Qt4 Table Item Spanning

  1. #1
    Join Date
    Dec 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt4 Table Item Spanning

    I am attempting to span table items for the first time and I am having some interesting results.

    The code:

    table->setColumnCount(1);
    table->setRowCount(32);

    QTableWidgetItem *newItem = new QTableWidgetItem("Label",0);

    table->setItem(0,0, newItem);
    table->setSpan(0,0,16,0);

    The result:

    I end up with what is close to what I would expect. The table has one large item spanning from rows 0 - 16 with the text "Label" in the vertical center. However, I also have the same text in what would be the original table item before the spanning took place. Results in two text tables, one in the (0,0) position and one near the (0,8) position.

    Is this a known issue? Am I doing something wrong? Any help would be greatly appreciated.

    -Bill

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt4 Table Item Spanning

    Try setSpan( 0, 0, 16, 1 );

    I think the "rowSpan" and "columnSpan" arguments are counts, not cell indexes. It isn't clear from the documentation.

    David

Similar Threads

  1. Postgresql QSqlRelationalTableModel empty table
    By RolandHughes in forum Qt Programming
    Replies: 0
    Last Post: 12th November 2008, 17:18
  2. Replies: 2
    Last Post: 13th September 2008, 13:55
  3. View, Scene, Item and thread??
    By dungsivn in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2008, 19:21
  4. Item Delegate Painting
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2008, 07:37
  5. Replies: 1
    Last Post: 19th April 2007, 22:23

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.