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