From f7d12ac485c91b206b2fe0882b858b3303e7a857 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 30 Jan 2014 09:41:03 +0100 Subject: [PATCH] MacOsX >= 10.8 fixed issue on text widget creation --- src/domain/UBGraphicsTextItem.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/domain/UBGraphicsTextItem.cpp b/src/domain/UBGraphicsTextItem.cpp index f1f23e6b..b3bdfb48 100644 --- a/src/domain/UBGraphicsTextItem.cpp +++ b/src/domain/UBGraphicsTextItem.cpp @@ -41,8 +41,8 @@ #include "core/memcheck.h" QColor UBGraphicsTextItem::lastUsedTextColor; -UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) : - QGraphicsTextItem(parent) +UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) + : QGraphicsTextItem(parent) , UBGraphicsItem() , mMultiClickState(0) , mLastMousePressTime(QTime::currentTime()) @@ -344,9 +344,15 @@ UBGraphicsScene* UBGraphicsTextItem::scene() void UBGraphicsTextItem::resize(qreal w, qreal h) { +#ifdef Q_WS_MACX + // Claudio Mac os x >= 10.8. + // on text widget creation sometimes the computed height is completely wrong (more than 10^10) + setTextWidth(w > 10000 ? 250 : w); + setTextHeight(h > 10000 ? 80 : h); +#else setTextWidth(w); setTextHeight(h); - +#endif if (Delegate()) Delegate()->positionHandles(); }