|
|
@ -1027,6 +1027,16 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() : |
|
|
|
{ |
|
|
|
{ |
|
|
|
createContextMenu(); |
|
|
|
createContextMenu(); |
|
|
|
setToolTip(tr("Unit to show amounts in. Click to select another unit.")); |
|
|
|
setToolTip(tr("Unit to show amounts in. Click to select another unit.")); |
|
|
|
|
|
|
|
QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits(); |
|
|
|
|
|
|
|
int max_width = 0; |
|
|
|
|
|
|
|
const QFontMetrics fm(font()); |
|
|
|
|
|
|
|
foreach (const BitcoinUnits::Unit unit, units) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setMinimumSize(max_width, 0); |
|
|
|
|
|
|
|
setAlignment(Qt::AlignRight | Qt::AlignVCenter); |
|
|
|
|
|
|
|
setStyleSheet(QString("QLabel { color : %1 }").arg(SingleColor().name())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** So that it responds to button clicks */ |
|
|
|
/** So that it responds to button clicks */ |
|
|
@ -1066,7 +1076,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel) |
|
|
|
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ |
|
|
|
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ |
|
|
|
void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) |
|
|
|
void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setPixmap(SingleColorIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); |
|
|
|
setText(BitcoinUnits::name(newUnits)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Shows context menu with Display Unit options by the mouse coordinates */ |
|
|
|
/** Shows context menu with Display Unit options by the mouse coordinates */ |
|
|
|