本文整理汇总了C++中QPixmap::increaseUseCount方法的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap::increaseUseCount方法的具体用法?C++ QPixmap::increaseUseCount怎么用?C++ QPixmap::increaseUseCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPixmap
的用法示例。
在下文中一共展示了QPixmap::increaseUseCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPixmap
void RenderImage::setPixmap( const QPixmap &p, const QRect& r, CachedImage *o)
{
if(o != image) {
RenderReplaced::setPixmap(p, r, o);
return;
}
bool iwchanged = false;
if(o->isErrorImage()) {
int iw = p.width() + 8;
int ih = p.height() + 8;
// we have an alt and the user meant it (its not a text we invented)
if ( element() && !alt.isEmpty() && !element()->getAttribute( ATTR_ALT ).isNull()) {
const QFontMetrics &fm = style()->fontMetrics();
QRect br = fm.boundingRect ( 0, 0, 1024, 256, Qt::AlignAuto|Qt::WordBreak, alt.string() );
if ( br.width() > iw )
iw = br.width();
if ( br.height() > ih )
ih = br.height();
}
if ( iw != intrinsicWidth() ) {
setIntrinsicWidth( iw );
iwchanged = true;
}
if ( ih != intrinsicHeight() ) {
setIntrinsicHeight( ih );
iwchanged = true;
}
}
berrorPic = o->isErrorImage();
bool needlayout = false;
// Image dimensions have been changed, see what needs to be done
if ( ( o->pixmap_size().width() != intrinsicWidth() ||
o->pixmap_size().height() != intrinsicHeight() || iwchanged) )
{
// qDebug("image dimensions have been changed, old: %d/%d new: %d/%d",
// intrinsicWidth(), intrinsicHeight(),
// o->pixmap_size().width(), o->pixmap_size().height());
if(!o->isErrorImage()) {
setIntrinsicWidth( o->pixmap_size().width() );
setIntrinsicHeight( o->pixmap_size().height() );
}
// In the case of generated image content using :before/:after, we might not be in the
// render tree yet. In that case, we don't need to worry about check for layout, since we'll get a
// layout when we get added in to the render tree hierarchy later.
if (containingBlock()) {
// lets see if we need to relayout at all..
int oldwidth = m_width;
int oldheight = m_height;
calcWidth();
calcHeight();
if(iwchanged || m_width != oldwidth || m_height != oldheight)
needlayout = true;
m_width = oldwidth;
m_height = oldheight;
}
}
#if APPLE_CHANGES && !KWIQ //FIXME: testing for animations
// Stop the previous image, if it may be animating.
pix.stopAnimations();
#endif
#if APPLE_CHANGES
pix.decreaseUseCount();
#endif
pix = p;
#if APPLE_CHANGES
p.increaseUseCount();
#endif
if (needlayout) {
if (!selfNeedsLayout())
setNeedsLayout(true);
if (minMaxKnown())
setMinMaxKnown(false);
}
else {
#if APPLE_CHANGES
// FIXME: We always just do a complete repaint, since we always pass in the full pixmap
// rect at the moment anyway.
resizeCache = QPixmap();
repaintRectangle(QRect(borderLeft()+paddingLeft(), borderTop()+paddingTop(), contentWidth(), contentHeight()));
#else
// FIXME: This code doesn't handle scaling properly, since it doesn't scale |r|.
bool completeRepaint = !resizeCache.isNull();
int cHeight = contentHeight();
int scaledHeight = intrinsicHeight() ? ((o->valid_rect().height()*cHeight)/intrinsicHeight()) : 0;
// don't bog down X server doing xforms
if(completeRepaint && cHeight >= 5 && o->valid_rect().height() < intrinsicHeight() &&
//.........这里部分代码省略.........