aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-07 21:57:02 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-07 21:57:02 +0100
commitbad9f0780e8dfca230e0cc6c32d60e845887aaf9 (patch)
treecff91345abc173ee774f31381ab5079eab631965 /qtmips_gui/coreview
parenta0bc62d72314aa1c1946f0b1affe5bbe0dc64274 (diff)
downloadqtmips-bad9f0780e8dfca230e0cc6c32d60e845887aaf9.tar.gz
qtmips-bad9f0780e8dfca230e0cc6c32d60e845887aaf9.tar.bz2
qtmips-bad9f0780e8dfca230e0cc6c32d60e845887aaf9.zip
View register numbers in decimal notation.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/coreview')
-rw-r--r--qtmips_gui/coreview/value.cpp6
-rw-r--r--qtmips_gui/coreview/value.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/qtmips_gui/coreview/value.cpp b/qtmips_gui/coreview/value.cpp
index 12f7a55..9a3ab09 100644
--- a/qtmips_gui/coreview/value.cpp
+++ b/qtmips_gui/coreview/value.cpp
@@ -41,9 +41,11 @@ using namespace coreview;
#define LETWIDTH 7
// TODO orientation
-Value::Value(bool vertical, unsigned width, std::uint32_t init_val) : QGraphicsObject(nullptr) {
+Value::Value(bool vertical, unsigned width, std::uint32_t init_val,
+ unsigned a_base) : QGraphicsObject(nullptr) {
wid = width;
val = init_val;
+ base = a_base;
this->vertical = vertical;
}
@@ -68,7 +70,7 @@ void Value::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __at
painter->setBackgroundMode(Qt::OpaqueMode);
painter->drawRect(rect);
painter->setBackgroundMode(Qt::TransparentMode);
- QString str = QString("%1").arg(val, wid, 16, QChar('0'));
+ QString str = QString("%1").arg(val, wid, base, QChar('0'));
if (vertical) {
rect.setHeight(HEIGHT + 1);
for (unsigned i = 0; i < wid; i++) {
diff --git a/qtmips_gui/coreview/value.h b/qtmips_gui/coreview/value.h
index d6cac8a..755a9b2 100644
--- a/qtmips_gui/coreview/value.h
+++ b/qtmips_gui/coreview/value.h
@@ -44,7 +44,8 @@ namespace coreview {
class Value : public QGraphicsObject {
Q_OBJECT
public:
- Value(bool vertical = false, unsigned width = 8, unsigned init_val = 0); // width is for number of character to be shown from number
+ Value(bool vertical = false, unsigned width = 8,
+ unsigned init_val = 0, unsigned base = 16); // width is for number of character to be shown from number
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@@ -57,6 +58,7 @@ protected:
private:
unsigned wid;
+ unsigned base;
bool vertical;
};