VERY experimental Nintendo Switch 2 emulator
C++
software_keyboard: Add max and current length display to dialog
Zach Hilman945fdd93615e
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cppindex 83b9c320be..efefb1f99f 100644--- a/src/yuzu/applets/software_keyboard.cpp+++ b/src/yuzu/applets/software_keyboard.cpp@@ -47,7 +47,7 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(layout = new QVBoxLayout;header_label = new QLabel(QString::fromStdU16String(parameters.header_text));- header_label->setFont({header_label->font().family(), 12, QFont::Bold});+ header_label->setFont({header_label->font().family(), 11, QFont::Bold});if (header_label->text().isEmpty())header_label->setText(tr("Enter text:"));@@ -59,6 +59,10 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(guide_label = new QLabel(QString::fromStdU16String(parameters.guide_text));guide_label->setHidden(parameters.guide_text.empty());+ length_label = new QLabel(QStringLiteral("0/%1").arg(parameters.max_length));+ length_label->setAlignment(Qt::AlignRight);+ length_label->setFont({length_label->font().family(), 8});+line_edit = new QLineEdit;line_edit->setValidator(new QtSoftwareKeyboardValidator(parameters));line_edit->setMaxLength(static_cast<int>(parameters.max_length));@@ -67,6 +71,10 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(parameters.cursor_at_beginning ? 0 : static_cast<int>(parameters.initial_text.size()));line_edit->setEchoMode(parameters.password ? QLineEdit::Password : QLineEdit::Normal);+ connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) {+ length_label->setText(QStringLiteral("%1/%2").arg(text.size()).arg(parameters.max_length));+ });+buttons = new QDialogButtonBox;buttons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);buttons->addButton(parameters.submit_text.empty()@@ -79,6 +87,7 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(layout->addWidget(header_label);layout->addWidget(sub_label);layout->addWidget(guide_label);+ layout->addWidget(length_label);layout->addWidget(line_edit);layout->addWidget(buttons);setLayout(layout);diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.hindex 8d56f5db2e..73f56714f9 100644--- a/src/yuzu/applets/software_keyboard.h+++ b/src/yuzu/applets/software_keyboard.h@@ -47,6 +47,7 @@ private:QLabel* header_label;QLabel* sub_label;QLabel* guide_label;+ QLabel* length_label;QLineEdit* line_edit;QVBoxLayout* layout;