X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=47106398ae0ba6e065f9f4052c8732aed21dbaa1;hb=8fe8accd73abf77ab21d2d1c1346d2bc5c4de2ff;hp=d189ff5178b32d6fda39e9dd9d98f6c719882477;hpb=9d54503555534a2c554f09a33df6afa33d6308ec;p=quassel.git diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index d189ff51..47106398 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,6 @@ #include "chatlinemodel.h" #include "chatview.h" #include "contextmenuactionprovider.h" -#include "iconloader.h" #include "mainwin.h" #include "qtui.h" #include "qtuistyle.h" @@ -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 { @@ -800,7 +798,7 @@ void ContentsChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) switch (click.type()) { case Clickable::Url: privateData()->activeClickable = click; - menu->addAction(SmallIcon("edit-copy"), tr("Copy Link Address"), + menu->addAction(QIcon::fromTheme("edit-copy"), tr("Copy Link Address"), &_actionProxy, SLOT(copyLinkToClipboard()))->setData(QVariant::fromValue(this)); break; case Clickable::Channel: @@ -838,7 +836,7 @@ void ContentsChatItem::copyLinkToClipboard() void ContentsChatItem::showWebPreview(const Clickable &click) { -#ifndef HAVE_WEBKIT +#if !defined HAVE_WEBKIT && !defined HAVE_WEBENGINE Q_UNUSED(click); #else QTextLine line = layout()->lineForTextPosition(click.start()); @@ -861,7 +859,7 @@ void ContentsChatItem::showWebPreview(const Clickable &click) void ContentsChatItem::clearWebPreview() { -#ifdef HAVE_WEBKIT +#if defined HAVE_WEBKIT || defined HAVE_WEBENGINE chatScene()->clearWebPreview(this); #endif }