allow max font size to be defined by user (#2488)

This commit is contained in:
Zach H 2017-03-19 14:13:20 -04:00 committed by GitHub
parent 1cc50b2793
commit a2a7561613
5 changed files with 25 additions and 4 deletions

View file

@ -3,6 +3,7 @@
#include <QCursor>
#include <QGraphicsSceneMouseEvent>
#include <cmath>
#include <algorithm>
#ifdef _WIN32
#include "round.h"
#endif /* _WIN32 */
@ -66,6 +67,9 @@ QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
{
const int MAX_FONT_SIZE = settingsCache->getMaxFontSize();
const int fontSize = std::max(9, MAX_FONT_SIZE);
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
painter->resetTransform();
@ -77,9 +81,6 @@ void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &transla
painter->setTransform(pixmapTransform);
QFont f;
int fontSize = round(translatedSize.height() / 8);
if (fontSize < 9)
fontSize = 9;
f.setPixelSize(fontSize);
painter->setFont(f);