mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
use QPainter::setClipRect
This commit is contained in:
parent
0af05929f7
commit
e4c52e6118
|
@ -37,6 +37,8 @@ qreal Image::getAscent() const
|
||||||
|
|
||||||
void Image::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
void Image::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||||
{
|
{
|
||||||
|
painter->setClipRect(boundingRect());
|
||||||
|
|
||||||
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
painter->translate(-size.width() / 2.0, -size.height() / 2.0);
|
painter->translate(-size.width() / 2.0, -size.height() / 2.0);
|
||||||
painter->drawPixmap(0, 0, pmap);
|
painter->drawPixmap(0, 0, pmap);
|
||||||
|
|
|
@ -42,6 +42,8 @@ QRectF NotificationIcon::boundingRect() const
|
||||||
|
|
||||||
void NotificationIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void NotificationIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
painter->setClipRect(boundingRect());
|
||||||
|
|
||||||
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
painter->translate(-size.width() / 2.0, -size.height() / 2.0);
|
painter->translate(-size.width() / 2.0, -size.height() / 2.0);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ QRectF Spinner::boundingRect() const
|
||||||
|
|
||||||
void Spinner::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
void Spinner::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||||
{
|
{
|
||||||
|
painter->setClipRect(boundingRect());
|
||||||
|
|
||||||
QTransform rotMat;
|
QTransform rotMat;
|
||||||
rotMat.translate(size.width() / 2.0, size.height() / 2.0);
|
rotMat.translate(size.width() / 2.0, size.height() / 2.0);
|
||||||
rotMat.rotate(rot);
|
rotMat.rotate(rot);
|
||||||
|
|
|
@ -155,6 +155,8 @@ void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWid
|
||||||
{
|
{
|
||||||
if(doc)
|
if(doc)
|
||||||
{
|
{
|
||||||
|
painter->setClipRect(boundingRect());
|
||||||
|
|
||||||
// draw selection
|
// draw selection
|
||||||
QAbstractTextDocumentLayout::PaintContext ctx;
|
QAbstractTextDocumentLayout::PaintContext ctx;
|
||||||
QAbstractTextDocumentLayout::Selection sel;
|
QAbstractTextDocumentLayout::Selection sel;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user