fix multi-byte key/value size calculation

This commit is contained in:
kvazar-network 2024-06-09 18:30:52 +03:00
parent 65fee98933
commit 2ff0b57e1e

View File

@ -78,9 +78,9 @@ void KevaAddKeyDialog::cancel()
void KevaAddKeyDialog::onKeyChanged(const QString& key) void KevaAddKeyDialog::onKeyChanged(const QString& key)
{ {
// Calculate current length // Calculate current size
int keyTextLength = key.length(); int keyTextLength = key.toStdString().size();
int valueTextLength = ui->valueText->toPlainText().length(); int valueTextLength = ui->valueText->toPlainText().toStdString().size();
// Update counter value // Update counter value
ui->keyCounter->setText( ui->keyCounter->setText(
@ -112,9 +112,9 @@ void KevaAddKeyDialog::onKeyChanged(const QString& key)
void KevaAddKeyDialog::onValueChanged() void KevaAddKeyDialog::onValueChanged()
{ {
// Calculate current length // Calculate current size
int keyTextLength = ui->keyText->text().length(); int keyTextLength = ui->keyText->text().toStdString().size();
int valueTextLength = ui->valueText->toPlainText().length(); int valueTextLength = ui->valueText->toPlainText().toStdString().size();
// Update counter value // Update counter value
ui->valueCounter->setText( ui->valueCounter->setText(