本文整理汇总了C++中QPixmap::toWinHICON方法的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap::toWinHICON方法的具体用法?C++ QPixmap::toWinHICON怎么用?C++ QPixmap::toWinHICON使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPixmap
的用法示例。
在下文中一共展示了QPixmap::toWinHICON方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
if (!pITask)
return;
const HWND winId = hwndOfWidget(Core::ICore::mainWindow());
if (text.isEmpty()) {
pITask->SetOverlayIcon(winId, NULL, NULL);
} else {
QPixmap pix = QPixmap(QLatin1String(":/core/images/compile_error_taskbar.png"));
QPainter p(&pix);
p.setPen(Qt::white);
QFont font = p.font();
font.setPointSize(font.pointSize()-2);
p.setFont(font);
p.drawText(QRect(QPoint(0,0), pix.size()), Qt::AlignHCenter|Qt::AlignCenter, text);
#if QT_VERSION >= 0x050000
const HICON icon = qt_pixmapToWinHICON(pix);
#else
const HICON icon = pix.toWinHICON();
#endif
pITask->SetOverlayIcon(winId, icon, (wchar_t*)text.utf16());
DestroyIcon(icon);
}
}
示例2: setBadge
void WindowsTaskBar::setBadge(const QString &badge)
{
if (badge.isEmpty())
clearOverlayIcon(window()->winId());
else {
QPixmap pixmap = createBadge(badge);
setOverlayIcon(window()->winId(), pixmap.toWinHICON());
}
}
示例3:
/*
* Convert QIcon to HICON -> caller is responsible for destroying the HICON!
*/
static HICON mixp_qicon2hicon(const QIcon &icon, const int w, const int h)
{
if(!icon.isNull())
{
QPixmap pixmap = icon.pixmap(w, h);
if(!pixmap.isNull())
{
return pixmap.toWinHICON();
}
}
return NULL;
}
示例4: setOverlayIcon
/*!
Applies an overlay to the taskbar button of the given window handle to indicate
application status or a notification to the user.
\a pixmap image to apply as the overlay icon.
\a accessibilityDescription provides an alt text version of the information conveyed by the overlay for accessibility purposes
*/
bool IntegratedMainWindow::setOverlayIcon(const QPixmap &pixmap, const QString &accessibilityDescription)
{
#ifdef Q_WS_WIN
if (!pixmap.isNull())
{
return setOverlayIcon(pixmap.toWinHICON(), accessibilityDescription);
}
#else
Q_UNUSED(pixmap);
Q_UNUSED(accessibilityDescription);
#endif
return false;
}
示例5: createIcon
void QSystemTrayIconSys::createIcon()
{
hIcon = 0;
QIcon icon = q->icon();
if (icon.isNull())
return;
//const QSize preferredSize(GetSystemMetrics(SM_CXSMICON) * 2, GetSystemMetrics(SM_CYSMICON) * 2);
const QSize preferredSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
QPixmap pm = icon.pixmap(preferredSize);
if (pm.isNull())
return;
hIcon = pm.toWinHICON();
}
示例6: createIcon
void QSystemTrayIconSys::createIcon()
{
hIcon = 0;
QIcon icon = q->icon();
if (icon.isNull())
return;
const int iconSizeX = GetSystemMetrics(SM_CXSMICON);
const int iconSizeY = GetSystemMetrics(SM_CYSMICON);
QSize size = icon.actualSize(QSize(iconSizeX, iconSizeY));
QPixmap pm = icon.pixmap(size);
if (pm.isNull())
return;
hIcon = pm.toWinHICON();
}