From 2ff0b57e1e1273d2475f5c525cbdc534e2dc4882 Mon Sep 17 00:00:00 2001 From: kvazar-network Date: Sun, 9 Jun 2024 18:30:52 +0300 Subject: [PATCH] fix multi-byte key/value size calculation --- src/qt/kevaaddkeydialog.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qt/kevaaddkeydialog.cpp b/src/qt/kevaaddkeydialog.cpp index d96822309..8b8583afe 100644 --- a/src/qt/kevaaddkeydialog.cpp +++ b/src/qt/kevaaddkeydialog.cpp @@ -78,9 +78,9 @@ void KevaAddKeyDialog::cancel() void KevaAddKeyDialog::onKeyChanged(const QString& key) { - // Calculate current length - int keyTextLength = key.length(); - int valueTextLength = ui->valueText->toPlainText().length(); + // Calculate current size + int keyTextLength = key.toStdString().size(); + int valueTextLength = ui->valueText->toPlainText().toStdString().size(); // Update counter value ui->keyCounter->setText( @@ -112,9 +112,9 @@ void KevaAddKeyDialog::onKeyChanged(const QString& key) void KevaAddKeyDialog::onValueChanged() { - // Calculate current length - int keyTextLength = ui->keyText->text().length(); - int valueTextLength = ui->valueText->toPlainText().length(); + // Calculate current size + int keyTextLength = ui->keyText->text().toStdString().size(); + int valueTextLength = ui->valueText->toPlainText().toStdString().size(); // Update counter value ui->valueCounter->setText(