[Qt] extend validate line edit and btc address validator

- remove btc address length from address validator
- add an optional btc address check in validated line edit that defaults
  to off and is used in GUIUtil::setupAddressWidget()
- an isAcceptable() check is added to validated line edit on focus out
  which only kicks in, when a validator is used with that widget
- remove an isAcceptable() check from sendcoinsentry.cpp
- remove obsolete attributes from ui files, which are set by calling
  GUIUtil::setupAddressWidget()
- move some more things to GUIUtil::setupAddressWidget() and remove them
  from normal code e.g. placeholder text
This commit is contained in:
Philip Kaufmann
2013-11-20 15:56:51 +01:00
committed by Wladimir J. van der Laan
parent aab8fc58c6
commit c78bd93701
11 changed files with 140 additions and 55 deletions

View File

@@ -6,6 +6,7 @@
#include "bitcoinaddressvalidator.h"
#include "bitcoinunits.h"
#include "qvalidatedlineedit.h"
#include "walletmodel.h"
#include "core.h"
@@ -72,11 +73,16 @@ QFont bitcoinAddressFont()
return font;
}
void setupAddressWidget(QLineEdit *widget, QWidget *parent)
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
{
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
widget->setValidator(new BitcoinAddressValidator(parent));
parent->setFocusProxy(widget);
widget->setFont(bitcoinAddressFont());
#if QT_VERSION >= 0x040700
widget->setPlaceholderText(QObject::tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
#endif
widget->setValidator(new BitcoinAddressEntryValidator(parent));
widget->setCheckValidator(new BitcoinAddressCheckValidator(parent));
}
void setupAmountWidget(QLineEdit *widget, QWidget *parent)