forked from blue/squawk
better way to solve yesterday font problem, small visual avatar rendering fix
This commit is contained in:
parent
15fb4bbd62
commit
d4bf7e599a
9 changed files with 62 additions and 56 deletions
|
@ -16,22 +16,20 @@
|
|||
|
||||
#include "keydelegate.h"
|
||||
#include <QPainter>
|
||||
#include <QFontDatabase>
|
||||
|
||||
#include "keysmodel.h"
|
||||
#include <shared/global.h>
|
||||
|
||||
constexpr int minHeight = 50;
|
||||
constexpr int minWidth = 400;
|
||||
constexpr uint8_t margin = 10;
|
||||
constexpr uint8_t partSize = 8;
|
||||
constexpr uint8_t maxSingleLineParts = 3;
|
||||
|
||||
UI::KeyDelegate::KeyDelegate(QObject* parent):
|
||||
QStyledItemDelegate(parent),
|
||||
fingerPrintFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)),
|
||||
labelFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)),
|
||||
fingerPrintMetrics(fingerPrintFont),
|
||||
labelFontMetrics(labelFont),
|
||||
fingerPrintFont(Shared::Global::getInstance()->defaultFont),
|
||||
labelFont(Shared::Global::getInstance()->smallFont),
|
||||
fingerPrintMetrics(Shared::Global::getInstance()->defaultFontMetrics),
|
||||
labelFontMetrics(Shared::Global::getInstance()->smallFontMetrics),
|
||||
spaceWidth(fingerPrintMetrics.horizontalAdvance(" "))
|
||||
{}
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ public:
|
|||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
|
||||
private:
|
||||
QFont fingerPrintFont;
|
||||
QFont labelFont;
|
||||
QFontMetrics fingerPrintMetrics;
|
||||
QFontMetrics labelFontMetrics;
|
||||
const QFont& fingerPrintFont;
|
||||
const QFont& labelFont;
|
||||
const QFontMetrics& fingerPrintMetrics;
|
||||
const QFontMetrics& labelFontMetrics;
|
||||
int spaceWidth;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue