本文整理汇总了C++中QPixmap::x11Info方法的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap::x11Info方法的具体用法?C++ QPixmap::x11Info怎么用?C++ QPixmap::x11Info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPixmap
的用法示例。
在下文中一共展示了QPixmap::x11Info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
// Qt has qt_toX11Pixmap(), but that's sadly not public API. So the only
// option seems to be to create X11-based QPixmap using QPixmap::fromX11Pixmap()
// and draw the non-native pixmap to it.
// NOTE: The alpha-channel is not preserved if it exists, but for X pixmaps it generally should not be needed anyway.
QPixmap X11EmbedContainer::toX11Pixmap(const QPixmap& pix)
{
if(pix.handle() != 0) // X11 pixmap
return pix;
Pixmap xpix = XCreatePixmap(pix.x11Info().display(), RootWindow(pix.x11Info().display(), pix.x11Info().screen()),
pix.width(), pix.height(), QX11Info::appDepth());
QPixmap wrk = QPixmap::fromX11Pixmap(xpix);
QPainter paint(&wrk);
paint.drawPixmap(0, 0, pix);
paint.end();
QPixmap ret = wrk.copy();
wrk = QPixmap(); // reset, so that xpix can be freed (QPixmap does not own it)
XFreePixmap(pix.x11Info().display(), xpix);
return ret;
}
示例2: backingStore
/*!
\return A pixmap that can be used as backing store
\param widget Widget, for which the backinstore is intended
\param size Size of the pixmap
*/
QPixmap QwtPainter::backingStore( QWidget *widget, const QSize &size )
{
QPixmap pm;
#define QWT_HIGH_DPI 1
#if QT_VERSION >= 0x050000 && QWT_HIGH_DPI
qreal pixelRatio = 1.0;
if ( widget && widget->windowHandle() )
{
pixelRatio = widget->windowHandle()->devicePixelRatio();
}
else
{
if ( qApp )
pixelRatio = qApp->devicePixelRatio();
}
pm = QPixmap( size * pixelRatio );
pm.setDevicePixelRatio( pixelRatio );
#else
Q_UNUSED( widget )
pm = QPixmap( size );
#endif
#if 0
#ifdef Q_WS_X11
if ( pm.x11Info().screen() != x11Info().screen() )
pm.x11SetScreen( x11Info().screen() );
#endif
#endif
return pm;
}