From 76512a087076a4fe6733cc37c81a390d3afdb59f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Oct 2010 18:08:59 +0200 Subject: [PATCH] Text rendering fix --- cockatrice/cockatrice.pro | 1 - cockatrice/resources/countries/hu.svg | 4 ++-- cockatrice/resources/countries/ie.svg | 4 ++-- cockatrice/resources/countries/jp.svg | 4 ++-- cockatrice/resources/countries/nl.svg | 8 +++---- cockatrice/resources/countries/se.svg | 10 ++++----- cockatrice/resources/countries/tr.svg | 32 +++++++++++++-------------- cockatrice/resources/countries/us.svg | 22 +++++++++--------- cockatrice/src/abstractcarditem.cpp | 2 +- cockatrice/src/carditem.cpp | 4 +++- 10 files changed, 46 insertions(+), 45 deletions(-) diff --git a/cockatrice/cockatrice.pro b/cockatrice/cockatrice.pro index c905b6c6..03ceb383 100644 --- a/cockatrice/cockatrice.pro +++ b/cockatrice/cockatrice.pro @@ -6,7 +6,6 @@ MOC_DIR = build OBJECTS_DIR = build RESOURCES = cockatrice.qrc QT += network svg -CONFIG += debug HEADERS += src/counter.h \ src/dlg_creategame.h \ diff --git a/cockatrice/resources/countries/hu.svg b/cockatrice/resources/countries/hu.svg index 7345483c..55919674 100644 --- a/cockatrice/resources/countries/hu.svg +++ b/cockatrice/resources/countries/hu.svg @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/cockatrice/resources/countries/ie.svg b/cockatrice/resources/countries/ie.svg index b14caef2..2550980d 100644 --- a/cockatrice/resources/countries/ie.svg +++ b/cockatrice/resources/countries/ie.svg @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/cockatrice/resources/countries/jp.svg b/cockatrice/resources/countries/jp.svg index 8f454752..05ca6995 100644 --- a/cockatrice/resources/countries/jp.svg +++ b/cockatrice/resources/countries/jp.svg @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/cockatrice/resources/countries/nl.svg b/cockatrice/resources/countries/nl.svg index f19bd004..e75ca06a 100644 --- a/cockatrice/resources/countries/nl.svg +++ b/cockatrice/resources/countries/nl.svg @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/cockatrice/resources/countries/se.svg b/cockatrice/resources/countries/se.svg index 65db1571..99dea167 100644 --- a/cockatrice/resources/countries/se.svg +++ b/cockatrice/resources/countries/se.svg @@ -1,5 +1,5 @@ - - - - - + + + + + diff --git a/cockatrice/resources/countries/tr.svg b/cockatrice/resources/countries/tr.svg index 623ecb06..ea26973d 100644 --- a/cockatrice/resources/countries/tr.svg +++ b/cockatrice/resources/countries/tr.svg @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/cockatrice/resources/countries/us.svg b/cockatrice/resources/countries/us.svg index f02c7a82..3f1081cc 100644 --- a/cockatrice/resources/countries/us.svg +++ b/cockatrice/resources/countries/us.svg @@ -1,12 +1,12 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/cockatrice/src/abstractcarditem.cpp b/cockatrice/src/abstractcarditem.cpp index 2f6a880b..908c7eaa 100644 --- a/cockatrice/src/abstractcarditem.cpp +++ b/cockatrice/src/abstractcarditem.cpp @@ -118,7 +118,7 @@ void AbstractCardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * transformPainter(painter, translatedSize); painter->setPen(textColor); - painter->drawText(QRectF(2 * scaleFactor, 2 * scaleFactor, translatedSize.width() - 4 * scaleFactor, translatedSize.height() - 4 * scaleFactor), Qt::AlignTop | Qt::AlignLeft | Qt::TextWrapAnywhere, name); + painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8 * scaleFactor, translatedSize.height() - 8 * scaleFactor), Qt::AlignTop | Qt::AlignLeft | Qt::TextWrapAnywhere, name); } painter->restore(); diff --git a/cockatrice/src/carditem.cpp b/cockatrice/src/carditem.cpp index 1020f912..12fdcd91 100644 --- a/cockatrice/src/carditem.cpp +++ b/cockatrice/src/carditem.cpp @@ -172,12 +172,14 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, if (!pt.isEmpty()) { painter->save(); QSizeF translatedSize = getTranslatedSize(painter); + + qreal scaleFactor = translatedSize.width() / boundingRect().width(); transformPainter(painter, translatedSize); painter->setBackground(Qt::black); painter->setBackgroundMode(Qt::OpaqueMode); painter->setPen(Qt::white); - painter->drawText(QRectF(2, 2, translatedSize.width() - 4, translatedSize.height() - 4), Qt::AlignRight | Qt::AlignBottom, pt); + painter->drawText(QRectF(4 * scaleFactor, 4 * scaleFactor, translatedSize.width() - 8, translatedSize.height() - 8), Qt::AlignRight | Qt::AlignBottom, pt); painter->restore(); } if (getBeingPointedAt())