lbrycrd/src/qt/guiutil.cpp

40 lines
1.1 KiB
C++
Raw Normal View History

2011-05-27 18:38:30 +02:00
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
2011-07-03 20:53:56 +02:00
#include "headers.h"
2011-05-27 18:38:30 +02:00
#include <QString>
2011-05-27 18:38:30 +02:00
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
2011-05-27 18:38:30 +02:00
QString GUIUtil::DateTimeStr(qint64 nTime)
2011-05-27 18:38:30 +02:00
{
2011-06-25 23:14:10 +02:00
QDateTime date = QDateTime::fromTime_t((qint32)nTime);
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm");
2011-05-27 18:38:30 +02:00
}
2011-06-01 20:08:21 +02:00
QFont GUIUtil::bitcoinAddressFont()
2011-06-01 20:08:21 +02:00
{
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
return font;
}
void GUIUtil::setupAddressWidget(QLineEdit *widget, QWidget *parent)
{
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
widget->setValidator(new BitcoinAddressValidator(parent));
widget->setFont(bitcoinAddressFont());
}
void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent)
{
QDoubleValidator *amountValidator = new QDoubleValidator(parent);
amountValidator->setDecimals(8);
amountValidator->setBottom(0.0);
widget->setValidator(amountValidator);
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}