Results 1 to 10 of 10

Thread: QTableView from SQLite, empty!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView from SQLite, empty!

    Quote Originally Posted by grellsworth View Post
    QSqlRelationalTableModel model;

    model.setTable("tracks");
    model.setEditStrategy(QSqlTableModel::OnManualSubm it);
    model.select();

    setTable(&model);
    You create the model on the stack, so it gets destroyed as soon as it goes out of scope, leaving a dangling pointer behind. Better create that model on the heap (i.e. using the new operator).

  2. The following user says thank you to jacek for this useful post:

    grellsworth (3rd July 2007)

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.