diff --git a/src/ExtendedTableWidget.cpp b/src/ExtendedTableWidget.cpp index 5fa822ef..7dde5a95 100644 --- a/src/ExtendedTableWidget.cpp +++ b/src/ExtendedTableWidget.cpp @@ -108,13 +108,16 @@ ExtendedTableWidgetEditorDelegate::ExtendedTableWidgetEditorDelegate(QObject* pa QWidget* ExtendedTableWidgetEditorDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& index) const { - // Just create a normal line editor but set the maximum length to the highest possible value instead of the default 32768. QLineEdit* editor = new QLineEdit(parent); - QCompleter *completer = new QCompleter(editor); - completer->setModel(const_cast(index.model())); - completer->setCompletionColumn(index.column()); - completer->setCompletionMode(QCompleter::InlineCompletion); - editor->setCompleter(completer); + // If the row count is not greater than the complete threshold setting, set a completer of values based on current values in the column. + if (index.model()->rowCount() <= Settings::getValue("databrowser", "complete_threshold").toInt()) { + QCompleter *completer = new QCompleter(editor); + completer->setModel(const_cast(index.model())); + completer->setCompletionColumn(index.column()); + completer->setCompletionMode(QCompleter::InlineCompletion); + editor->setCompleter(completer); + } + // Set the maximum length to the highest possible value instead of the default 32768. editor->setMaxLength(std::numeric_limits::max()); return editor; } diff --git a/src/PreferencesDialog.cpp b/src/PreferencesDialog.cpp index c0f378e3..ead82c13 100644 --- a/src/PreferencesDialog.cpp +++ b/src/PreferencesDialog.cpp @@ -100,6 +100,7 @@ void PreferencesDialog::loadSettings() loadColorSetting(ui->fr_reg_bg, "reg_bg"); ui->spinSymbolLimit->setValue(Settings::getValue("databrowser", "symbol_limit").toInt()); + ui->spinCompleteThreshold->setValue(Settings::getValue("databrowser", "complete_threshold").toInt()); ui->txtNull->setText(Settings::getValue("databrowser", "null_text").toString()); ui->txtBlob->setText(Settings::getValue("databrowser", "blob_text").toString()); ui->editFilterEscape->setText(Settings::getValue("databrowser", "filter_escape").toString()); @@ -209,6 +210,7 @@ void PreferencesDialog::saveSettings() saveColorSetting(ui->fr_bin_fg, "bin_fg"); saveColorSetting(ui->fr_bin_bg, "bin_bg"); Settings::setValue("databrowser", "symbol_limit", ui->spinSymbolLimit->value()); + Settings::setValue("databrowser", "complete_threshold", ui->spinCompleteThreshold->value()); Settings::setValue("databrowser", "null_text", ui->txtNull->text()); Settings::setValue("databrowser", "blob_text", ui->txtBlob->text()); Settings::setValue("databrowser", "filter_escape", ui->editFilterEscape->text()); diff --git a/src/PreferencesDialog.ui b/src/PreferencesDialog.ui index 12a6d0e0..f2d9944d 100644 --- a/src/PreferencesDialog.ui +++ b/src/PreferencesDialog.ui @@ -469,6 +469,40 @@ + + + + + 0 + 0 + + + + This is the maximum number of rows in a table for enabling the value completion based on current values in the column. +Can be set to 0 for disabling completion. + + + This is the maximum number of rows in a table for enabling the value completion based on current values in the column. +Can be set to 0 for disabling completion. + + + 0 + + + 100000000 + + + + + + + Row count threshold for completion + + + spinCompleteThreshold + + + diff --git a/src/Settings.cpp b/src/Settings.cpp index 53783e86..a0f77f54 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -176,6 +176,8 @@ QVariant Settings::getDefaultValue(const QString& group, const QString& name) return 10; if(name == "symbol_limit") return 5000; + if(name == "complete_threshold") + return 1000; if(name == "indent_compact") return false; if(name == "auto_switch_mode")