Results 1 to 2 of 2

Thread: Empty qsqlrelationaltablemodel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Posts
    4
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Exclamation Empty qsqlrelationaltablemodel

    When I put model->select(); after relations, the model is empty, when I put it back before relations, the table displays correctly, but when I edit any cell the whole row becomes empty and gets "!" on the left. No errors.

    Qt Code:
    1. model->setTable("syllabi");
    2. model->setEditStrategy(QSqlTableModel::OnFieldChange);
    3. model->select();
    4. model->setRelation(3, QSqlRelation("activity_types", "activity_type_id", "activity_type_name"));
    5. model->setRelation(0, QSqlRelation("teachers", "teacher_id", "teacher_name"));
    6. //model->select();
    7. qDebug() << model->lastError();
    8.  
    9. ui->tableView->setModel(model);
    10. ui->tableView->setItemDelegate(new QSqlRelationalDelegate(ui->tableView));
    11. ui->tableView->horizontalHeader()->setStretchLastSection(true);
    12. ui->tableView->setColumnHidden(9, true);
    To copy to clipboard, switch view to plain text mode 
    Last edited by Charlie42; 17th July 2015 at 12:55.

Similar Threads

  1. How to put empty value in QDateEdit?
    By sawerset in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2019, 21:06
  2. is QString empty?
    By timmu in forum Qt Programming
    Replies: 2
    Last Post: 16th January 2010, 22:17
  3. Status Bar Empty
    By waynew in forum Newbie
    Replies: 5
    Last Post: 22nd November 2009, 13:01
  4. QTreeView is empty
    By t0bias in forum Qt Programming
    Replies: 2
    Last Post: 31st August 2008, 11:22
  5. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 07:30

Tags for this Thread

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.