Results 1 to 6 of 6

Thread: tableView Problem

  1. #1
    Join Date
    Jan 2008
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default tableView Problem

    Is there anybody here can help me view my records in MySQL to the tableView?

    thanks....

  2. #2
    Join Date
    Jan 2008
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default tableView Problem

    Please help....

    I'm new to Qt and I don't know much of the functions yet..

    Heres my problem, I trying to view my records from MySQL to the tableView, but I haven't find a right code.

    Please give me a simple code to this.


    thanks...

  3. #3
    Join Date
    Oct 2007
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tableView Problem

    use this...

    Qt Code:
    1. model = new QSqlTableModel(this);
    2. model->setTable(trainingname);//trainingname-name of table to be viewed
    3. model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    4. model->select();
    5.  
    6. model->setHeaderData(0, Qt::Horizontal, tr("CERTIFICATES"));
    7. model->setHeaderData(1, Qt::Horizontal, tr("CERTIFICATE NO."));
    8. model->setHeaderData(2, Qt::Horizontal, tr("TRAINING CENTER"));
    9. model->setHeaderData(3, Qt::Horizontal, tr("DATE"));
    10. model->sort(0, Qt::AscendingOrder);
    11. view = new QTableView;
    12. view->setModel(model);
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 6th February 2008 at 07:39. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2008
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: tableView Problem

    thanks, i finally made it...

  5. #5
    Join Date
    Jan 2008
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Can't view records in table view

    I have added a tableView widget in my interface using the designer.

    The problem is, I can't find a right code to view my records in it. I'm using MySQL database. Please help...

    tnx...

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: tableView Problem

    What did you try so far? I thought you already made it.
    J-P Nurmi

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  2. tableview model view problem
    By skuda in forum Qt Programming
    Replies: 5
    Last Post: 3rd December 2007, 14:02
  3. Replies: 15
    Last Post: 8th May 2007, 11:46
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.