Tweaked value label positioning on BitsetWidget
This commit is contained in:
@@ -55,10 +55,10 @@ void BitsetWidget::drawWidget(QPainter& painter) {
|
|||||||
auto byteHex = "0x" + QString::number(this->byte, 16).toUpper();
|
auto byteHex = "0x" + QString::number(this->byte, 16).toUpper();
|
||||||
|
|
||||||
painter.setPen(QColor("#474747"));
|
painter.setPen(QColor("#474747"));
|
||||||
constexpr int labelHeight = 10;
|
constexpr int labelHeight = 11;
|
||||||
int containerWidth = this->width();
|
int containerWidth = this->width();
|
||||||
constexpr int charWidth = 6;
|
constexpr int charWidth = 6;
|
||||||
auto labelWidth = (charWidth * byteHex.size()) + 13;
|
auto labelWidth = static_cast<int>(charWidth * byteHex.size()) + 13;
|
||||||
auto width = (containerWidth - (BitWidget::WIDTH) - labelWidth) / 2;
|
auto width = (containerWidth - (BitWidget::WIDTH) - labelWidth) / 2;
|
||||||
|
|
||||||
painter.drawLine(QLine(
|
painter.drawLine(QLine(
|
||||||
@@ -91,10 +91,13 @@ void BitsetWidget::drawWidget(QPainter& painter) {
|
|||||||
|
|
||||||
painter.setPen(QColor("#8a8a8d"));
|
painter.setPen(QColor("#8a8a8d"));
|
||||||
painter.drawText(
|
painter.drawText(
|
||||||
static_cast<int>(
|
QRect(
|
||||||
std::floor((BitWidget::WIDTH / 2) + width + ((labelWidth - (byteHex.size() * charWidth)) / 2))
|
static_cast<int>((BitWidget::WIDTH / 2) + width),
|
||||||
|
BitWidget::HEIGHT + BitsetWidget::VALUE_GRAPHIC_HEIGHT - (labelHeight / 2),
|
||||||
|
labelWidth,
|
||||||
|
labelHeight
|
||||||
),
|
),
|
||||||
BitWidget::HEIGHT + BitsetWidget::VALUE_GRAPHIC_HEIGHT + (labelHeight / 2),
|
Qt::AlignCenter,
|
||||||
byteHex
|
byteHex
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user