X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=3d2e065ebe33fd817833a3764896e1abac58b6fa;hp=d1443a680ff7c664dab184472595fcf2ad39ce4a;hb=952ac961af5ad09fa4105de5c938c147b260b3a0;hpb=709d88e1d7cede7fee485b85798413468f324abe diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index d1443a68..3d2e065e 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -265,7 +265,7 @@ void ChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { void SenderChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); - //painter->setClipRect(boundingRect()); // no idea why QGraphicsItem clipping won't work + painter->setClipRect(boundingRect()); // no idea why QGraphicsItem clipping won't work qreal layoutWidth = layout()->minimumWidth(); qreal offset = 0; if(chatScene()->senderCutoffMode() == ChatScene::CutoffLeft) @@ -278,7 +278,7 @@ 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 - QPixmap pixmap(QSize(layout()->boundingRect().width(), layout()->boundingRect().height())); + QPixmap pixmap(layout()->boundingRect().toRect().size()); pixmap.fill(Qt::transparent); QPainter pixPainter(&pixmap); layout()->draw(&pixPainter, QPointF(qMax(offset, (qreal)0), 0), QVector() << selectFmt); @@ -359,7 +359,7 @@ void ContentsChatItem::doLayout() { QList ContentsChatItem::findClickables() const { // For matching URLs static QString urlEnd("(?:>|[,.;:\"]*\\s|\\b|$)"); - static QString urlChars("(?:[,.;:]*[\\w\\-~@/?&=+$()!%#])"); + static QString urlChars("(?:[,.;:]*[\\w\\-~@/?&=+$()!%#*|{}\\[\\]])"); static QRegExp regExp[] = { // URL @@ -457,7 +457,7 @@ void ContentsChatItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { case Clickable::Url: if(!str.contains("://")) str = "http://" + str; - QDesktopServices::openUrl(str); + QDesktopServices::openUrl(QUrl::fromEncoded(str.toAscii())); break; case Clickable::Channel: // TODO join or whatever... @@ -534,7 +534,9 @@ void ContentsChatItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { } void ContentsChatItem::showWebPreview(const Clickable &click) { -#ifdef HAVE_WEBKIT +#ifndef HAVE_WEBKIT + Q_UNUSED(click); +#else QTextLine line = layout()->lineForTextPosition(click.start); qreal x = line.cursorToX(click.start); qreal width = line.cursorToX(click.start + click.length) - x;