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.
This commit is contained in:
ANISH M 2023-02-18 22:06:31 +05:30
parent 3a29ba6d49
commit d2081257db
No known key found for this signature in database
GPG Key ID: AF0CD7ABA6CE44A2

View File

@ -33,6 +33,7 @@
#include <QTimer>
#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