Results 1 to 1 of 1

Thread: revertAll() failure question

  1. #1
    Join Date
    Jan 2012
    Posts
    46
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    11

    Default revertAll() failure question

    All --

    Got a weird problem -- I have a QSqlTableModel that I would like to roll back any changes a user had made to it via a QTableView, but when my cancel slot executes, my app just hangs on the command and I have to kill it from a task manager...I'm sure it's the revertAll command because if I make no edits and cancel I don't have a problem (plus I encased it in qDebug() statements)

    Here's the definition of my model
    Qt Code:
    1. swaymodel = new QSqlTableModel(this);
    2. swaymodel->setTable("sway");
    3. swaymodel->setEditStrategy(QSqlTableModel::OnManualSubmit);
    4. swaymodel->setHeaderData(0, Qt::Horizontal, QObject::tr("Period"));
    5. swaymodel->setHeaderData(1, Qt::Horizontal, QObject::tr("Phase"));
    6. swaymodel->setFilter (QString("sway_dataset_id = %1").arg(rig_dataset));
    7. swaymodel->select();
    8.  
    9. ui->SwayTV->setModel(swaymodel);
    To copy to clipboard, switch view to plain text mode 

    Here is the slot connected to a Cancel tool button
    Qt Code:
    1. void RAOEntryDialog::on_RAO_CancelTB_clicked()
    2. {
    3. sway_model->revertAll();
    4. RAOEntryDialog::close();
    5. }
    To copy to clipboard, switch view to plain text mode 

    And the table definition
    Qt Code:
    1. //***********************************
    2. //* Create table for Sway data... *
    3. //***********************************
    4. sql_command = "create table sway (sway_period INTEGER NOT NULL, ";
    5. sql_command.append("sway_phase INTEGER NOT NULL, ");
    6. sql_command.append("sway_seq_no INTEGER NOT NULL, ");
    7. sql_command.append("sway_dataset_id INTEGER NOT NULL, ");
    8. sql_command.append("sway_rig_id INTEGER NOT NULL, ");
    9. sql_command.append("sway_user_name TEXT NOT NULL, ");
    10. sql_command.append("sway_activity_date DATE NOT NULL)");
    To copy to clipboard, switch view to plain text mode 

    I found that if I can get the same result if instead of reverting I, "sway_model->select ()" but I am curious if anyone has had this happen, too...


    Kodi
    Last edited by mtnbiker66; 16th March 2012 at 19:22.

Similar Threads

  1. Plot failure
    By Olmasi in forum Qwt
    Replies: 0
    Last Post: 31st March 2011, 18:14
  2. QFileDialog failure
    By johnmauer in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2011, 11:00
  3. Qt Creator Debugger failure
    By Carlton in forum Qt Tools
    Replies: 3
    Last Post: 23rd November 2010, 21:58
  4. Failure to build qt 4.5.1
    By doggrant in forum Qt Programming
    Replies: 1
    Last Post: 24th June 2009, 16:47
  5. DLL Failure on Winblows
    By ComaWhite in forum Qt Programming
    Replies: 1
    Last Post: 7th September 2008, 17:07

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.