Regexp validator
This commit is contained in:
@@ -98,6 +98,9 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
ab.setupUi(&d);
|
ab.setupUi(&d);
|
||||||
Settings::saveRestore(&d);
|
Settings::saveRestore(&d);
|
||||||
|
|
||||||
|
QRegExpValidator v(QRegExp(Settings::labelRegExp), ab.label);
|
||||||
|
ab.label->setValidator(&v);
|
||||||
|
|
||||||
AddressBookModel model(ab.addresses);
|
AddressBookModel model(ab.addresses);
|
||||||
ab.addresses->setModel(&model);
|
ab.addresses->setModel(&model);
|
||||||
|
|
||||||
|
|||||||
@@ -1045,6 +1045,10 @@ void MainWindow::setupRecieveTab() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Validator for label
|
||||||
|
QRegExpValidator* v = new QRegExpValidator(QRegExp(Settings::labelRegExp), ui->rcvLabel);
|
||||||
|
ui->rcvLabel->setValidator(v);
|
||||||
|
|
||||||
// Select item in address list
|
// Select item in address list
|
||||||
QObject::connect(ui->listRecieveAddresses,
|
QObject::connect(ui->listRecieveAddresses,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged), [=] (int index) {
|
QOverload<int>::of(&QComboBox::currentIndexChanged), [=] (int index) {
|
||||||
|
|||||||
@@ -204,3 +204,4 @@ bool Settings::isValidAddress(QString addr) {
|
|||||||
ztsexp.exactMatch(addr) || zsexp.exactMatch(addr);
|
ztsexp.exactMatch(addr) || zsexp.exactMatch(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString Settings::labelRegExp("[a-zA-Z0-9\\-_]{0,40}");
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public:
|
|||||||
|
|
||||||
static bool isValidAddress(QString addr);
|
static bool isValidAddress(QString addr);
|
||||||
|
|
||||||
|
static const QString labelRegExp;
|
||||||
|
|
||||||
static const int updateSpeed = 20 * 1000; // 20 sec
|
static const int updateSpeed = 20 * 1000; // 20 sec
|
||||||
static const int quickUpdateSpeed = 5 * 1000; // 5 sec
|
static const int quickUpdateSpeed = 5 * 1000; // 5 sec
|
||||||
static const int priceRefreshSpeed = 60 * 60 * 1000; // 1 hr
|
static const int priceRefreshSpeed = 60 * 60 * 1000; // 1 hr
|
||||||
|
|||||||
Reference in New Issue
Block a user