equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the demonstration applications of the Qt Toolkit. |
7 ** This file is part of the demonstration applications of the Qt Toolkit. |
8 ** |
8 ** |
144 |
144 |
145 void Browser::showTable(const QString &t) |
145 void Browser::showTable(const QString &t) |
146 { |
146 { |
147 QSqlTableModel *model = new QSqlTableModel(table, connectionWidget->currentDatabase()); |
147 QSqlTableModel *model = new QSqlTableModel(table, connectionWidget->currentDatabase()); |
148 model->setEditStrategy(QSqlTableModel::OnRowChange); |
148 model->setEditStrategy(QSqlTableModel::OnRowChange); |
149 model->setTable(t); |
149 model->setTable(connectionWidget->currentDatabase().driver()->escapeIdentifier(t, QSqlDriver::TableName)); |
150 model->select(); |
150 model->select(); |
151 if (model->lastError().type() != QSqlError::NoError) |
151 if (model->lastError().type() != QSqlError::NoError) |
152 emit statusMessage(model->lastError().text()); |
152 emit statusMessage(model->lastError().text()); |
153 table->setModel(model); |
153 table->setModel(model); |
154 table->setEditTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed); |
154 table->setEditTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed); |