From d2081257db1797cf76b22b014390f4ceceda8fec Mon Sep 17 00:00:00 2001 From: ANISH M <58029804+Anish-M-code@users.noreply.github.com> Date: Sat, 18 Feb 2023 22:06:31 +0530 Subject: [PATCH] set character display limit label in Send coin dialog An attempt to fix bug tx confirmation window is getting out of the screen and can't click on "send" by setting a maximum of 45 characters to not wrap lines in the label and be able to add ... if the size exceeds that. --- src/qt/sendcoinsdialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 823291c41..ee523f43c 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -33,6 +33,7 @@ #include #define SEND_CONFIRM_DELAY 3 +#define CHARACTERS_DISPLAY_LIMIT_IN_LABEL 45 SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), @@ -276,7 +277,12 @@ void SendCoinsDialog::on_sendButton_clicked() { if(rcp.label.length() > 0) // label with address { - recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label)); + QString displayedLabel = rcp.label; + if (rcp.label.length() > CHARACTERS_DISPLAY_LIMIT_IN_LABEL) + { + displayedLabel = displayedLabel.left(CHARACTERS_DISPLAY_LIMIT_IN_LABEL).append("..."); // limit the amount of characters displayed in label + } + recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(displayedLabel)); recipientElement.append(QString(" (%1)").arg(address)); } else // just address