diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-04-02 17:02:20 +0200 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-04-02 17:02:20 +0200 |
commit | 476af4ac713b88597e628ff8415ae2890757d574 (patch) | |
tree | 33fc90a3b44ae2bc5da6fda924444beb455a59a4 /qtmips_gui/coreview | |
parent | 71a7c2e6791d62eaeddf8bd143c7cc1233912f2b (diff) | |
download | qtmips-476af4ac713b88597e628ff8415ae2890757d574.tar.gz qtmips-476af4ac713b88597e628ff8415ae2890757d574.tar.bz2 qtmips-476af4ac713b88597e628ff8415ae2890757d574.zip |
Implement stall cycles counter and view of CPU cycles counter.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/coreview')
-rw-r--r-- | qtmips_gui/coreview/value.cpp | 9 | ||||
-rw-r--r-- | qtmips_gui/coreview/value.h | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/qtmips_gui/coreview/value.cpp b/qtmips_gui/coreview/value.cpp index 1250fb1..9dbe2e0 100644 --- a/qtmips_gui/coreview/value.cpp +++ b/qtmips_gui/coreview/value.cpp @@ -43,11 +43,13 @@ using namespace coreview; // TODO orientation Value::Value(bool vertical, unsigned width, std::uint32_t init_val, - unsigned a_base) : QGraphicsObject(nullptr) { + unsigned a_base, QChar fillchr, bool frame) : QGraphicsObject(nullptr) { wid = width; val = init_val; base = a_base; this->vertical = vertical; + this->fillchr = fillchr; + this->frame = frame; } QRectF Value::boundingRect() const { @@ -69,9 +71,12 @@ void Value::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __at rect = QRectF(-(LETWIDTH*(int)wid)/2 - 0.5, -HEIGHT/2 - 0.5, LETWIDTH*wid + 1, HEIGHT + 1); painter->setBrush(QBrush(QColor(Qt::white))); painter->setBackgroundMode(Qt::OpaqueMode); + if (!frame) + painter->setPen(QColor(Qt::white)); painter->drawRect(rect); + painter->setPen(QColor(Qt::black)); painter->setBackgroundMode(Qt::TransparentMode); - QString str = QString("%1").arg(val, wid, base, QChar('0')); + QString str = QString("%1").arg(val, wid, base, fillchr); 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 755a9b2..a8c1e76 100644 --- a/qtmips_gui/coreview/value.h +++ b/qtmips_gui/coreview/value.h @@ -38,14 +38,16 @@ #include <QGraphicsObject> #include <QPainter> +#include <QChar> namespace coreview { class Value : public QGraphicsObject { Q_OBJECT public: - 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 + Value(bool vertical = false, unsigned width = 8, // width is for number of character to be shown from number + unsigned init_val = 0, unsigned base = 16, + QChar fillchr = '0', bool frame = true); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); @@ -60,6 +62,8 @@ private: unsigned wid; unsigned base; bool vertical; + QChar fillchr; + bool frame; }; } |