本文整理汇总了C++中Basket::icon方法的典型用法代码示例。如果您正苦于以下问题:C++ Basket::icon方法的具体用法?C++ Basket::icon怎么用?C++ Basket::icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basket
的用法示例。
在下文中一共展示了Basket::icon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateToolTip
void SystemTray::updateToolTip()
{
// return; /////////////////////////////////////////////////////
Basket *basket = Global::bnpView->currentBasket();
if (!basket)
return;
if (basket->icon().isEmpty() || basket->icon() == "basket" || ! Settings::showIconInSystray())
setPixmap(basket->isLocked() ? m_lockedIconPixmap : m_iconPixmap);
else {
// Code that comes from JuK:
QPixmap bgPix = loadIcon("basket");
QPixmap fgPix = SmallIcon(basket->icon());
QImage bgImage = bgPix.convertToImage(); // Probably 22x22
QImage fgImage = fgPix.convertToImage(); // Should be 16x16
QImage lockOverlayImage = loadIcon("lockoverlay").convertToImage();
KIconEffect::semiTransparent(bgImage);
copyImage(bgImage, fgImage, (bgImage.width() - fgImage.width()) / 2,
(bgImage.height() - fgImage.height()) / 2);
if (basket->isLocked())
KIconEffect::overlay(bgImage, lockOverlayImage);
bgPix.convertFromImage(bgImage);
setPixmap(bgPix);
}
//QTimer::singleShot( Container::c_delayTooltipTime, this, SLOT(updateToolTipDelayed()) );
// No need to delay: it's be called when notes are changed:
updateToolTipDelayed();
}
示例2: updateDisplay
/** Updates the icon and tooltip in the system tray */
void SystemTray::updateDisplay()
{
Basket *basket = Global::bnpView->currentBasket();
if (!basket)
return;
// Update the icon
if (basket->icon().isEmpty()
|| basket->icon() == "basket"
|| !Settings::showIconInSystray())
setIcon(basket->isLocked() ? m_lockedIcon : m_icon);
else {
// Code that comes from JuK:
QPixmap bgPix = loadIcon("basket").pixmap(m_iconSize);
int smallIconSize = kapp->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap fgPix = loadIcon(basket->icon()).pixmap(smallIconSize);
QImage bgImage = bgPix.toImage(); // Probably 22x22
QImage fgImage = fgPix.toImage(); // Should be 16x16
KIconEffect::semiTransparent(bgImage);
copyImage(bgImage, fgImage, bgImage.width()-fgImage.width() / 2,
bgImage.height()-fgImage.height() / 2);
if (basket->isLocked()) {
QImage lockOverlay = loadIcon("lockoverlay").pixmap(m_iconSize).toImage();
KIconEffect::overlay(bgImage, lockOverlay);
}
setIcon(QPixmap::fromImage(bgImage));
}
// update the tooltip
QString tip = "<p><nobr>";
QString basketName = "%1";
if (basket->isLocked())
basketName += i18n(" (Locked)");
tip += KDialog::makeStandardCaption(basketName);
tip = tip.arg(Tools::textToHTMLWithoutP(basket->basketName()));
setToolTip(tip);
}