shahzadafzal, starmyc, Xynerise
Thank you!
but I try change
amount->setDecimals(8);
to "5" in src\qt\bitcoinamountfield.cpp and
amountValidator->setDecimals(8);
No way. The number of zeros after the comma is still 8 and not 5.
How to change it in src\qt\bitcoingui.cpp - I do not understand.
Can you tell me please?
Okay, I was wrong.
Your widget is created in
bitcoinamountfield.cpp like this:
BitcoinAmountField::BitcoinAmountField(QWidget *parent):
QWidget(parent), amount(0), currentUnit(-1)
{
amount = new QDoubleSpinBox(this);
amount->setLocale(QLocale::c());
amount->setDecimals(8);
amount->installEventFilter(this);
amount->setMaximumWidth(500);
amount->setSingleStep(0.001);
...
// Set default based on configuration
unitChanged(unit->currentIndex());
}
But, the function (also a qt "slot") will also change it:
void BitcoinAmountField::unitChanged(int idx)
{
// Use description tooltip for current unit for the combobox
unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString());
// Determine new unit ID
int newUnit = unit->itemData(idx, BitcoinUnits::UnitRole).toInt();
// Parse current value and convert to new unit
bool valid = false;
qint64 currentValue = value(&valid);
currentUnit = newUnit;
// Set max length after retrieving the value, to prevent truncation
amount->setDecimals(BitcoinUnits::decimals(currentUnit));
...
If you want to change the number of decimals to 5, you need to change it in the UI constructor and in the BitcoinUnits::decimals function as well (or put 5 instead of modifying the function - at least, it worked for me on your coin source tree)