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.
This commit is contained in:
Peinthor Rene
2014-05-24 20:30:59 +02:00
committed by Martin Kleusberg
parent 42501d31fe
commit 516d71f146
2 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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...
}