X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=fe2bd563a7ec0e43cbcd3671ea89668fdd67231d;hb=dd8d82a90c136fa1e56d7f72781881cd5099574f;hp=bec1eb78e08bbdf6eeb6ed5ef14d629060f4ffb6;hpb=77176474b628e801ba94d9d50d0d961a12aa01c4;p=quassel.git diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index bec1eb78..fe2bd563 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2010 by the Quassel Project * + * Copyright (C) 2005-2012 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -115,11 +115,6 @@ void ChatItem::clearCache() { _cachedLayout = 0; } -void ChatItem::initLayout(QTextLayout *layout, QTextOption::WrapMode mode, Qt::Alignment alignment) const { - initLayoutHelper(layout, mode, alignment); - doLayout(layout); -} - void ChatItem::initLayoutHelper(QTextLayout *layout, QTextOption::WrapMode wrapMode, Qt::Alignment alignment) const { Q_ASSERT(layout); @@ -135,6 +130,11 @@ void ChatItem::initLayoutHelper(QTextLayout *layout, QTextOption::WrapMode wrapM layout->setAdditionalFormats(formatRanges); } +void ChatItem::initLayout(QTextLayout *layout) const { + initLayoutHelper(layout, QTextOption::NoWrap); + doLayout(layout); +} + void ChatItem::doLayout(QTextLayout *layout) const { layout->beginLayout(); QTextLine line = layout->createLine(); @@ -405,6 +405,11 @@ void ChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) { // SenderChatItem // ************************************************************ +void SenderChatItem::initLayout(QTextLayout *layout) const { + initLayoutHelper(layout, QTextOption::ManualWrap, Qt::AlignRight); + doLayout(layout); +} + void SenderChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); painter->save(); @@ -518,6 +523,11 @@ qreal ContentsChatItem::setGeometryByWidth(qreal w) { return h; } +void ContentsChatItem::initLayout(QTextLayout *layout) const { + initLayoutHelper(layout, QTextOption::WrapAtWordBoundaryOrAnywhere); + doLayout(layout); +} + void ContentsChatItem::doLayout(QTextLayout *layout) const { ChatLineModel::WrapList wrapList = data(ChatLineModel::WrapListRole).value(); if(!wrapList.count()) return; // empty chatitem @@ -587,7 +597,7 @@ QVector ContentsChatItem::additionalFormats() const { void ContentsChatItem::endHoverMode() { if(privateData()) { if(privateData()->currentClickable.isValid()) { - chatLine()->setCursor(Qt::ArrowCursor); + chatLine()->unsetCursor(); privateData()->currentClickable = Clickable(); } clearWebPreview();