X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=117ec10d4781b6ec75d6d27d2909b245f073df66;hb=6d2798ada0b9e770f821e039431cc9dc3b5f85cf;hp=85642666e87c153811a0b7b0f8d86dd6610cbadf;hpb=5b686746c880e5cda6d5de3e08180ea4332ff222;p=quassel.git diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 85642666..117ec10d 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2014 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -504,31 +504,29 @@ void SenderChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op if (layoutWidth > width()) { // Draw a nice gradient for longer items - // Qt's text drawing with a gradient brush sucks, so we use an alpha-channeled pixmap instead + // Qt's text drawing with a gradient brush sucks, so we use compositing instead QPixmap pixmap(layout()->boundingRect().toRect().size()); pixmap.fill(Qt::transparent); + QPainter pixPainter(&pixmap); layout()->draw(&pixPainter, QPointF(qMax(offset, (qreal)0), 0), additionalFormats()); - pixPainter.end(); // Create alpha channel mask - QPixmap mask(pixmap.size()); - QPainter maskPainter(&mask); QLinearGradient gradient; if (offset < 0) { gradient.setStart(0, 0); gradient.setFinalStop(12, 0); - gradient.setColorAt(0, Qt::black); + gradient.setColorAt(0, Qt::transparent); gradient.setColorAt(1, Qt::white); } else { gradient.setStart(width()-10, 0); gradient.setFinalStop(width(), 0); gradient.setColorAt(0, Qt::white); - gradient.setColorAt(1, Qt::black); + gradient.setColorAt(1, Qt::transparent); } - maskPainter.fillRect(0, 0, pixmap.width(), pixmap.height(), gradient); - pixmap.setAlphaChannel(mask); + pixPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); // gradient's alpha gets applied to the pixmap + pixPainter.fillRect(pixmap.rect(), gradient); painter->drawPixmap(pos(), pixmap); } else { @@ -805,9 +803,8 @@ void ContentsChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) break; case Clickable::Channel: { - // Hide existing menu actions, they confuse us when right-clicking on a clickable - foreach(QAction *action, menu->actions()) - action->setVisible(false); + // Remove existing menu actions, they confuse us when right-clicking on a clickable + menu->clear(); QString name = data(ChatLineModel::DisplayRole).toString().mid(click.start(), click.length()); GraphicalUi::contextMenuActionProvider()->addActions(menu, chatScene()->filter(), data(MessageModel::BufferIdRole).value(), name); break;