From 516d71f1467b6907da76d8766f489c59edcd12c5 Mon Sep 17 00:00:00 2001 From: Peinthor Rene Date: Sat, 24 May 2014 20:30:59 +0200 Subject: [PATCH] Don't show cells with long text values as BLOB Don't show cells with a text value longer than 1024 characters as '(BLOB)'. Also don't change back to binary mode in the EditDialog after manually switching to the text mode. Closes issue #16. --- src/EditDialog.cpp | 2 +- src/sqlitetablemodel.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditDialog.cpp b/src/EditDialog.cpp index ae1703dd..92571516 100644 --- a/src/EditDialog.cpp +++ b/src/EditDialog.cpp @@ -141,7 +141,7 @@ void EditDialog::checkDataType() { // Check if data is text only ui->comboEditor->setVisible(true); - if(QString(hexEdit->data()).toLatin1() == hexEdit->data()) // Any proper way?? + if(QString(hexEdit->data()).toUtf8() == hexEdit->data()) // Any proper way?? { ui->editorStack->setCurrentIndex(0); diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 38b3cda7..9ad94994 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -436,6 +436,6 @@ void SqliteTableModel::clearCache() bool SqliteTableModel::isBinary(const QModelIndex& index) const { - QByteArray val = m_data.at(index.row()).at(index.column()); - return val.size() > 1024 || val.contains('\0'); // Cheap BLOB test here... + QByteArray val = m_data.at(index.row()).at(index.column()).left(1024); + return val.contains('\0'); // Cheap BLOB test here... }