From 092c5edea4290db0be22f26898e483d9e39be8cc Mon Sep 17 00:00:00 2001 From: Tobias Markmann <tm@ayena.de> Date: Sat, 12 Oct 2013 10:58:45 +0200 Subject: Clip rendering of text in DelegateCommons. Ensure that text rendering bugs on some unicode characters (e.g. U+0E47, U+0E49) don't spill outside the indented drawing region. Change-Id: Ia6683c943d90adb572b6072b037a4e0886ac068c License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. diff --git a/Swift/QtUI/Roster/DelegateCommons.cpp b/Swift/QtUI/Roster/DelegateCommons.cpp index e7342f3..776d90c 100644 --- a/Swift/QtUI/Roster/DelegateCommons.cpp +++ b/Swift/QtUI/Roster/DelegateCommons.cpp @@ -14,7 +14,9 @@ namespace Swift { void DelegateCommons::drawElidedText(QPainter* painter, const QRect& region, const QString& text, int flags) { QString adjustedText(painter->fontMetrics().elidedText(text, Qt::ElideRight, region.width(), Qt::TextShowMnemonic)); + painter->setClipRect(region); painter->drawText(region, flags, adjustedText.simplified()); + painter->setClipping(false); } void DelegateCommons::paintContact(QPainter* painter, const QStyleOptionViewItem& option, const QColor& nameColor, const QString& avatarPath, const QIcon& presenceIcon, const QString& name, const QString& statusText, bool isIdle, int unreadCount, bool compact) const { -- cgit v0.10.2-6-g49f6