Results 1 to 4 of 4

Thread: Set up a table view

  1. #1
    Join Date
    Nov 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy Set up a table view

    Hello,

    I'm new to Qt and i'm trying to set up a table view that uses a csv file to fill. i managed to read the csv file and i'm stuck with the table view. i read a lot of documentation about it but i don't know how to start.
    i know i have to create a model and then the table view but i dont seem to get i tto work, any help !!
    If any one have an explained example of a table view (even with 1 or 2 columns ) that would be really helpful.

    THanks
    K|Z

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Set up a table view

    i know i have to create a model and then the table view but i dont seem to get i tto work, any help !!
    What is the problem with the model? how far did you go? Show how you re-implemented the virtual calls.

  3. #3
    Join Date
    Nov 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Set up a table view

    i just started, I'm very new to this so don't panic
    i added a tableview (tableDisplay) to my MainWindow and i stopped there.
    i managed to do some good stuff (reading csv file, filling a vector, ....), but i've never worked with tableviews.
    i don't know where to begin.

  4. #4
    Join Date
    Apr 2010
    Location
    Russian Federation, Kaluga
    Posts
    20
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Set up a table view

    Hi =)
    As start you can use QTableWidget (it's same QTableView and contains model inside). Every cell of table is a QTableWidgetItem.
    http://doc.qt.nokia.com/stable/qtreewidget.html#details

    As next step you can replace QTableWidget by QTableView + QStandartItemModel
    (instead of QTableWidgetItem you will operate with QStandartItem).
    http://doc.qt.nokia.com/stable/qstan...l.html#details

    Then you can create you fully customized model from QAbstractItemModel.
    I think this is a good way (from simple to complex).

    This example can be useful for you
    http://doc.qt.nokia.com/stable/itemv...treemodel.html

Similar Threads

  1. Replies: 1
    Last Post: 8th June 2011, 14:13
  2. Simple Table View
    By ruda in forum Newbie
    Replies: 3
    Last Post: 22nd March 2011, 22:05
  3. Replies: 5
    Last Post: 3rd April 2010, 04:07
  4. Table view
    By tulsi in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2009, 08:07
  5. Table Widget Vs. Table View
    By winston2020 in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2008, 09:56

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.