X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=b5fb62ae204012bd93d0486543048799b3654290;hp=c9d20c1e0271a98d7b7bce1373b1a8debfac0ea2;hb=6aaf227185e89aacd23ff25e3d5ff5030ace3093;hpb=279da77e67a66d2e0e239b3d7fd9809ac691dfc8 diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index c9d20c1e..b5fb62ae 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -34,7 +34,7 @@ ChatItem::ChatItem(const QPersistentModelIndex &index_, QGraphicsItem *parent) : } ChatItem::~ChatItem() { - + delete _layout; } QVariant ChatItem::data(int role) const { @@ -170,52 +170,6 @@ void ChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, } } - -/* -void ChatItem::layout() { - if(!_layout.additionalFormats().count()) return; // no text set - if(_width <= 0) return; - prepareGeometryChange(); - QFontMetrics metrics(_layout.additionalFormats()[0].format.font()); - int leading = metrics.leading(); - int height = 0; - _layout.setTextOption(textOption()); - _layout.beginLayout(); - while(1) { - QTextLine line = _layout.createLine(); - if(!line.isValid()) break; - line.setLineWidth(_width); - if(textOption().wrapMode() != QTextOption::NoWrap && line.naturalTextWidth() > _width) { - // word did not fit, we need to wrap it in the middle - // this is a workaround for Qt failing to handle WrapAtWordBoundaryOrAnywhere correctly - QTextOption::WrapMode mode = textOption().wrapMode(); - textOption().setWrapMode(QTextOption::WrapAnywhere); - _layout.setTextOption(textOption()); - line.setLineWidth(_width); - textOption().setWrapMode(mode); - _layout.setTextOption(textOption()); - } - height += leading; - line.setPosition(QPoint(0, height)); - height += line.height(); - } - _layout.endLayout(); - update(); -} QDateTime _timestamp; - MsgId _msgId; - - -QRectF ChatItem::boundingRect() const { - return _layout.boundingRect(); -} - -void ChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - Q_UNUSED(option); Q_UNUSED(widget); - _layout.draw(painter, QPointF(0, 0)); - -} -*/ - /* void ChatItem::mouseMoveEvent ( QGraphicsSceneMouseEvent * event ) { qDebug() << (void*)this << "moving" << event->pos();