diff options
author | bd <bdunahu@operationnull.com> | 2025-04-26 14:41:02 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-26 14:41:02 -0400 |
commit | b32bc409c18ceb4cd8147f11021e2c4b2746184b (patch) | |
tree | 588f2a5955e7c122f1df430280925034c910c42d | |
parent | 1c174cc103cb1b00befed6e52b40bb3e76cc7797 (diff) |
right-align colum headers on table objects
-rw-r--r-- | gui/digitlabeldelegate.cc | 6 | ||||
-rw-r--r-- | gui/digitlabeldelegate.h | 3 | ||||
-rw-r--r-- | gui/digitlabelhelper.h | 2 | ||||
-rw-r--r-- | 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 <QString> -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<int>(a)); + } + if (role != Qt::DisplayRole) return QVariant(); |