Corrected font bug in annotation items
This commit is contained in:
@@ -50,10 +50,7 @@ namespace Bloom::Widgets
|
||||
auto lineColor = this->getLineColor();
|
||||
auto labelFontColor = this->getLabelFontColor();
|
||||
|
||||
auto font = painter->font();
|
||||
font.setPixelSize(this->getLabelFontSize());
|
||||
font.setItalic(false);
|
||||
painter->setFont(font);
|
||||
painter->setFont(this->getLabelFont());
|
||||
|
||||
const auto isEnabled = this->isEnabled();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QFont>
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
@@ -60,8 +61,15 @@ namespace Bloom::Widgets
|
||||
return QColor(0x68, 0x68, 0x68);
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual int getLabelFontSize() const {
|
||||
return 12;
|
||||
[[nodiscard]] virtual const QFont& getLabelFont() const {
|
||||
static auto labelFont = std::optional<QFont>();
|
||||
|
||||
if (!labelFont.has_value()) {
|
||||
labelFont = QFont("'Ubuntu', sans-serif");
|
||||
labelFont->setPixelSize(12);
|
||||
}
|
||||
|
||||
return labelFont.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
void ValueAnnotationItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
|
||||
auto font = painter->font();
|
||||
font.setItalic(true);
|
||||
painter->setFont(font);
|
||||
|
||||
AnnotationItem::paint(painter, option, widget);
|
||||
|
||||
if (this->size > 1) {
|
||||
|
||||
@@ -24,8 +24,16 @@ namespace Bloom::Widgets
|
||||
return QColor(0x94, 0x6F, 0x30);
|
||||
}
|
||||
|
||||
[[nodiscard]] int getLabelFontSize() const override {
|
||||
return 11;
|
||||
[[nodiscard]] const QFont& getLabelFont() const override {
|
||||
static auto labelFont = std::optional<QFont>();
|
||||
|
||||
if (!labelFont.has_value()) {
|
||||
labelFont = QFont("'Ubuntu', sans-serif");
|
||||
labelFont->setPixelSize(11);
|
||||
labelFont->setItalic(true);
|
||||
}
|
||||
|
||||
return labelFont.value();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user