Results 1 to 3 of 3

Thread: QTableView row/column count [SOLVED]

  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default QTableView row/column count [SOLVED]

    Hi,

    I'd like to know how many rows/columns my qTableView has.

    I was trying something like:

    Qt Code:
    1. QAbstractItemModel* tableModel= my_table->model();
    2. QModelIndex index = my_table->currentIndex();
    3.  
    4. int iRows = tableModel->rowCount(index);
    To copy to clipboard, switch view to plain text mode 

    But it doesn't work

    How I can do it? thanks!
    Last edited by jano_alex_es; 14th May 2009 at 12:10. Reason: Solved

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableView row/column count

    try this
    Qt Code:
    1. QAbstractItemModel* tableModel= my_table->model();
    2. int iRows = tableModel->rowCount();
    3. int iCols = tableModel->columCount();
    To copy to clipboard, switch view to plain text mode 
    e.g. don't specify a parent.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. The following user says thank you to spirit for this useful post:

    jano_alex_es (14th May 2009)

  4. #3
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: QTableView row/column count

    hehehe, it was so easy... :P

    don't know why, I was obfuscated with its parent.

    thanks!

Similar Threads

  1. Program running error in qtopia 2.2.0
    By halloworld in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 15th February 2009, 10:23
  2. Replies: 3
    Last Post: 29th January 2009, 09:38
  3. QTableView in ui with model/delegate
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 7th November 2008, 00:00
  4. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 15:43
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 14:49

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.