Results 1 to 3 of 3

Thread: What's wrong with QxtSqlPackageModel

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question What's wrong with QxtSqlPackageModel

    I tried use QxtSqlPackageModel like this. But data not show in QTableView
    Qt Code:
    1. a.exec("select * from anggota");
    2.  
    3. QxtSqlPackage sp;
    4. sp.insert(a);
    5.  
    6. qDebug() << sp.count();
    7.  
    8.  
    9. QxtSqlPackageModel model;
    10. model.setQuery(sp);
    11.  
    12. ui->tableView->setModel(&model);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: What's wrong with QxtSqlPackageModel

    Likely it's because you don't create your model on the heap! It is destroyed after you leave the scope. (Unless your code is not in your main function.)

  3. #3
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: What's wrong with QxtSqlPackageModel

    You right. must create on the heap

Similar Threads

  1. Replies: 1
    Last Post: 3rd February 2011, 10:38
  2. Replies: 7
    Last Post: 17th July 2009, 09:40
  3. QextSerialPort reading error: wrong values
    By Lawand in forum Qt Programming
    Replies: 9
    Last Post: 6th May 2009, 19:29
  4. mouseMoveEvent contains wrong position?
    By draftpunk in forum Qt Programming
    Replies: 10
    Last Post: 12th September 2008, 01:59
  5. something wrong about KolourPaint
    By laozi888 in forum Qt Programming
    Replies: 1
    Last Post: 10th September 2008, 11: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.