update// reformated code in addresscombo.cpp
This commit is contained in:
@@ -2,29 +2,31 @@
|
|||||||
#include "addressbook.h"
|
#include "addressbook.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
AddressCombo::AddressCombo(QWidget* parent) :
|
AddressCombo::AddressCombo(QWidget* parent): QComboBox(parent)
|
||||||
QComboBox(parent) {
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QString AddressCombo::itemText(int i) {
|
QString AddressCombo::itemText(int i)
|
||||||
|
{
|
||||||
QString txt = QComboBox::itemText(i);
|
QString txt = QComboBox::itemText(i);
|
||||||
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddressCombo::currentText() {
|
QString AddressCombo::currentText()
|
||||||
|
{
|
||||||
QString txt = QComboBox::currentText();
|
QString txt = QComboBox::currentText();
|
||||||
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressCombo::setCurrentText(const QString& text) {
|
void AddressCombo::setCurrentText(const QString& text)
|
||||||
for (int i=0; i < count(); i++) {
|
{
|
||||||
if (itemText(i) == text) {
|
for (int i=0; i < count(); i++)
|
||||||
|
if (itemText(i) == text)
|
||||||
QComboBox::setCurrentIndex(i);
|
QComboBox::setCurrentIndex(i);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressCombo::addItem(const QString& text, CAmount bal) {
|
void AddressCombo::addItem(const QString& text, CAmount bal)
|
||||||
|
{
|
||||||
QString txt = AddressBook::addLabelToAddress(text);
|
QString txt = AddressBook::addLabelToAddress(text);
|
||||||
if (bal.toqint64() > 0)
|
if (bal.toqint64() > 0)
|
||||||
txt = txt % "(" % bal.toDecimalhushString() % ")";
|
txt = txt % "(" % bal.toDecimalhushString() % ")";
|
||||||
@@ -32,7 +34,8 @@ void AddressCombo::addItem(const QString& text, CAmount bal) {
|
|||||||
QComboBox::addItem(txt);
|
QComboBox::addItem(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressCombo::insertItem(int index, const QString& text, CAmount bal) {
|
void AddressCombo::insertItem(int index, const QString& text, CAmount bal)
|
||||||
|
{
|
||||||
QString txt = AddressBook::addLabelToAddress(text) %
|
QString txt = AddressBook::addLabelToAddress(text) %
|
||||||
"(" % bal.toDecimalhushString() % ")";
|
"(" % bal.toDecimalhushString() % ")";
|
||||||
QComboBox::insertItem(index, txt);
|
QComboBox::insertItem(index, txt);
|
||||||
|
|||||||
Reference in New Issue
Block a user