1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #3717

Diadlo (2):
      fix(text): Change idealSize calculation
      refactor(text): Add early break
This commit is contained in:
Zetok Zalbavar 2016-09-23 21:47:56 +01:00
commit 355cd453e3
No known key found for this signature in database
GPG Key ID: C953D3880212068A

View File

@ -150,8 +150,10 @@ QRectF Text::boundingRect() const
void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{ {
if (doc)
{ if (!doc)
return;
painter->setClipRect(boundingRect()); painter->setClipRect(boundingRect());
// draw selection // draw selection
@ -173,10 +175,6 @@ void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWid
// draw text // draw text
doc->documentLayout()->draw(painter, ctx); doc->documentLayout()->draw(painter, ctx);
}
Q_UNUSED(option)
Q_UNUSED(widget)
} }
void Text::visibilityChanged(bool visible) void Text::visibilityChanged(bool visible)
@ -293,7 +291,7 @@ void Text::freeResources()
QSizeF Text::idealSize() QSizeF Text::idealSize()
{ {
if (doc) if (doc)
return QSizeF(qMin(doc->idealWidth(), width), doc->size().height()); return doc->size();
return size; return size;
} }