本文整理汇总了C++中MyMoneySecurity::smallestAccountFraction方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMoneySecurity::smallestAccountFraction方法的具体用法?C++ MyMoneySecurity::smallestAccountFraction怎么用?C++ MyMoneySecurity::smallestAccountFraction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMoneySecurity
的用法示例。
在下文中一共展示了MyMoneySecurity::smallestAccountFraction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Set the values based on the @param security
*/
void KInvestmentDetailsWizardPage::init2(const MyMoneySecurity& security)
{
MyMoneySecurity tradingCurrency = MyMoneyFile::instance()->currency(security.tradingCurrency());
m_investmentSymbol->setText(security.tradingSymbol());
m_tradingMarket->setCurrentIndex(m_tradingMarket->findText(security.tradingMarket(), Qt::MatchExactly));
m_fraction->setValue(MyMoneyMoney(security.smallestAccountFraction(), 1));
m_tradingCurrencyEdit->setSecurity(tradingCurrency);
m_investmentIdentification->setText(security.value("kmm-security-id"));
}
示例2: KListViewItem
KInvestmentListItem::KInvestmentListItem(KListView* parent, const MyMoneyAccount& account)
: KListViewItem(parent)
{
bColumn5Negative = false;
bColumn6Negative = false;
bColumn7Negative = false;
bColumn8Negative = false;
bColumn9Negative = false;
m_account = account;
m_listView = parent;
MyMoneySecurity security;
MyMoneyFile* file = MyMoneyFile::instance();
security = file->security(m_account.currencyId());
m_tradingCurrency = file->security(security.tradingCurrency());
int prec = MyMoneyMoney::denomToPrec(m_tradingCurrency.smallestAccountFraction());
QValueList<MyMoneyTransaction> transactionList;
// FIXME PRICE
// equity_price_history history = equity.priceHistory();
//column 0 (COLUMN_NAME_INDEX) is the name of the stock
setText(COLUMN_NAME_INDEX, m_account.name());
//column 1 (COLUMN_SYMBOL_INDEX) is the ticker symbol
setText(COLUMN_SYMBOL_INDEX, security.tradingSymbol());
//column 2 is the net value (price * quantity owned)
MyMoneyPrice price = file->price(m_account.currencyId(), m_tradingCurrency.id());
if(price.isValid()) {
setText(COLUMN_VALUE_INDEX, (file->balance(m_account.id()) * price.rate(m_tradingCurrency.id())).formatMoney(m_tradingCurrency.tradingSymbol(), prec));
} else {
setText(COLUMN_VALUE_INDEX, "---");
}
//column 3 (COLUMN_QUANTITY_INDEX) is the quantity of shares owned
prec = MyMoneyMoney::denomToPrec(security.smallestAccountFraction());
setText(COLUMN_QUANTITY_INDEX, file->balance(m_account.id()).formatMoney("", prec));
//column 4 is the current price
// Get the price precision from the configuration
prec = KMyMoneyGlobalSettings::pricePrecision();
// prec = MyMoneyMoney::denomToPrec(m_tradingCurrency.smallestAccountFraction());
if(price.isValid()) {
setText(COLUMN_PRICE_INDEX, price.rate(m_tradingCurrency.id()).formatMoney(m_tradingCurrency.tradingSymbol(), prec));
} else {
setText(COLUMN_PRICE_INDEX, "---");
}
}
示例3: QWidget
kMyMoneyEdit::kMyMoneyEdit(const MyMoneySecurity& sec, QWidget *parent)
: QWidget(parent)
{
m_prec = MyMoneyMoney::denomToPrec(sec.smallestAccountFraction());
init();
}