From b32bc409c18ceb4cd8147f11021e2c4b2746184b Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 26 Apr 2025 14:41:02 -0400 Subject: right-align colum headers on table objects --- gui/digitlabeldelegate.cc | 6 ------ gui/digitlabeldelegate.h | 3 +-- gui/digitlabelhelper.h | 2 +- gui/storageview.cc | 7 +++++++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gui/digitlabeldelegate.cc b/gui/digitlabeldelegate.cc index 641b5a0..bf4b175 100644 --- a/gui/digitlabeldelegate.cc +++ b/gui/digitlabeldelegate.cc @@ -19,12 +19,6 @@ #include "digitlabelhelper.h" #include -DigitLabelDelegate::DigitLabelDelegate(QObject *parent) - : QStyledItemDelegate(parent) -{ - ; -} - void DigitLabelDelegate::set_hex_display(bool hex) { if (this->is_hex != hex) { diff --git a/gui/digitlabeldelegate.h b/gui/digitlabeldelegate.h index a823154..7714d25 100644 --- a/gui/digitlabeldelegate.h +++ b/gui/digitlabeldelegate.h @@ -28,9 +28,8 @@ class DigitLabelDelegate : public QStyledItemDelegate { Q_OBJECT - public: - explicit DigitLabelDelegate(QObject *parent = nullptr); + using QStyledItemDelegate::QStyledItemDelegate; public slots: void set_hex_display(bool hex); diff --git a/gui/digitlabelhelper.h b/gui/digitlabelhelper.h index 715089a..26e4637 100644 --- a/gui/digitlabelhelper.h +++ b/gui/digitlabelhelper.h @@ -36,7 +36,7 @@ class DigitLabelHelper { if (is_cleared) return QString(); - return is_hex ? QString::asprintf("%04X", value) + return is_hex ? QString::asprintf("%X", value) : QString::number(value); } }; diff --git a/gui/storageview.cc b/gui/storageview.cc index f6f9736..43837a9 100644 --- a/gui/storageview.cc +++ b/gui/storageview.cc @@ -48,6 +48,13 @@ QVariant StorageView::data(const QModelIndex &i, int role) const QVariant StorageView::headerData(int section, Qt::Orientation o, int role) const { + Qt::Alignment a; + + if (role == Qt::TextAlignmentRole) { + a = Qt::AlignRight | Qt::AlignVCenter; + return QVariant(static_cast(a)); + } + if (role != Qt::DisplayRole) return QVariant(); -- cgit v1.2.3