本文整理汇总了C++中QTextDocument::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextDocument::deleteLater方法的具体用法?C++ QTextDocument::deleteLater怎么用?C++ QTextDocument::deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextDocument
的用法示例。
在下文中一共展示了QTextDocument::deleteLater方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintEvent
//.........这里部分代码省略.........
int flags = align | (!text().isRightToLeft() ? Qt::TextForceLeftToRight : Qt::TextForceRightToLeft);
if (wordWrap())
flags |= Qt::TextWordWrap;
switch (shadowType)
{
case NoShadow:
flags |= TF_NOSHADOW;
break;
case DarkShadow:
flags |= TF_DARKSHADOW;
break;
case LightShadow:
flags |= TF_LIGHTSHADOW;
break;
default:
break;
}
QString textToDraw = elidedText();
style()->drawItemText(&painter, lr.toRect(), flags, opt.palette, isEnabled(), textToDraw, QPalette::WindowText);
#else // DEBUG_CUSTOMLABEL
QTextDocument *doc = textDocument();
QAbstractTextDocumentLayout::PaintContext ctx = textDocumentPaintContext(doc);
QString shadowKey;
switch (shadowType)
{
case DarkShadow:
shadowKey = GFX_TEXTSHADOWS;
break;
case LightShadow:
shadowKey = GFX_NOTICEWIDGET;
break;
case NoShadow:
default:
break;
}
// magic numbers
int dx = -2;
int dy = -2;
// adding margins
dx += contentsMargins().left();
dy += contentsMargins().top();
# if 1 // for debug set 0
QGraphicsDropShadowEffect *shadow = qobject_cast<QGraphicsDropShadowEffect *>(GraphicsEffectsStorage::staticStorage(RSR_STORAGE_GRAPHICSEFFECTS)->getFirstEffect(shadowKey));
# else // debug shadow
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect;
shadow->setColor(Qt::red);
shadow->setOffset(1, 1);
# endif
if (shadow)
{
# if 0 // for "image method" set 1
QImage shadowedText(size(), QImage::Format_ARGB32_Premultiplied);
# if defined(Q_WS_MAC) && !defined(__MAC_OS_X_NATIVE_FULLSCREEN)
// TODO: fix that
shadowedText.fill(Qt::red); // DUNNO WHY!!!
# else
shadowedText.fill(Qt::transparent);
# endif
QPainter tmpPainter(&shadowedText);
tmpPainter.setRenderHint(QPainter::Antialiasing);
tmpPainter.setRenderHint(QPainter::HighQualityAntialiasing);
tmpPainter.setRenderHint(QPainter::TextAntialiasing);
tmpPainter.setRenderHint(QPainter::SmoothPixmapTransform);
tmpPainter.translate(dx, dy);
doc->documentLayout()->draw(&tmpPainter, ctx);
painter.drawImage(0, 0, shadowedText);
# else // text method
QPalette origPal = ctx.palette;
ctx.palette.setColor(QPalette::Text, shadow->color());
// draw shadow
painter.save();
painter.translate(dx + shadow->xOffset(), dy + shadow->yOffset());
doc->documentLayout()->draw(&painter, ctx);
painter.restore();
ctx.palette = origPal;
// draw text
painter.save();
painter.translate(dx, dy);
doc->documentLayout()->draw(&painter, ctx);
painter.restore();
# endif // shadow method
}
else
{
painter.save();
painter.translate(dx, dy);
doc->documentLayout()->draw(&painter, ctx);
painter.restore();
}
doc->deleteLater();
#endif // DEBUG_CUSTOMLABEL
}
else
QLabel::paintEvent(pe);
}