From 8be2c54f51f174e1bf9e728e41f28d5a95b2cdb4 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Thu, 29 Sep 2016 20:09:35 +0200 Subject: [PATCH] Don't simplify table/index/... names when using them internally See issue #773. --- src/DbStructureModel.cpp | 2 ++ src/MainWindow.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DbStructureModel.cpp b/src/DbStructureModel.cpp index bd732e43..18d3820b 100644 --- a/src/DbStructureModel.cpp +++ b/src/DbStructureModel.cpp @@ -39,6 +39,8 @@ QVariant DbStructureModel::data(const QModelIndex& index, int role) const // Depending on the role either return the text or the icon if(role == Qt::DisplayRole) return Settings::getSettingsValue("db", "hideschemalinebreaks").toBool() ? item->text(index.column()).replace("\n", " ").simplified() : item->text(index.column()); + else if(role == Qt::EditRole) + return item->text(index.column()); else if(role == Qt::ToolTipRole) return item->text(index.column()); // Don't modify the text when it's supposed to be shown in a tooltip else if(role == Qt::DecorationRole) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 65776360..3f91be94 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -729,8 +729,8 @@ void MainWindow::compact() void MainWindow::deleteObject() { // Get name and type of object to delete - QString table = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString(); - QString type = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 1)).toString(); + QString table = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0), Qt::EditRole).toString(); + QString type = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 1), Qt::EditRole).toString(); // Ask user if he really wants to delete that table if(QMessageBox::warning(this, QApplication::applicationName(), tr("Are you sure you want to delete the %1 '%2'?\nAll data associated with the %1 will be lost.").arg(type).arg(table),