diff --git a/src/domain/UBGraphicsTextItem.cpp b/src/domain/UBGraphicsTextItem.cpp index b3bdfb48..cb9e4a64 100644 --- a/src/domain/UBGraphicsTextItem.cpp +++ b/src/domain/UBGraphicsTextItem.cpp @@ -48,7 +48,6 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) , mLastMousePressTime(QTime::currentTime()) , mTypeTextHereLabel(tr("")) { - mEmptyTextWidth = QFontMetrics(font()).width(mTypeTextHereLabel); setDelegate(new UBGraphicsTextItemDelegate(this, 0)); // TODO claudio remove this because in contrast with the fact the frame should be created on demand. @@ -331,7 +330,7 @@ void UBGraphicsTextItem::contentsChanged() if (toPlainText().isEmpty()) { - resize(textWidth(),textHeight()); + resize(QFontMetrics(font()).width(mTypeTextHereLabel),QFontMetrics(font()).height()); } } @@ -344,15 +343,8 @@ 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(); } diff --git a/src/domain/UBGraphicsTextItem.h b/src/domain/UBGraphicsTextItem.h index b25b3837..5d96c315 100644 --- a/src/domain/UBGraphicsTextItem.h +++ b/src/domain/UBGraphicsTextItem.h @@ -99,7 +99,6 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes void setSelected(bool selected); QString mTypeTextHereLabel; - int mEmptyTextWidth; signals: void textUndoCommandAdded(UBGraphicsTextItem *textItem);