diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-26 17:55:57 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-26 17:55:57 +0100 |
commit | 816b01b99eb770958589aadab25cd5e103917003 (patch) | |
tree | 8dc7f55e42a2c015ca0bbaf97a290fd7ca063b85 /qtmips_gui/coreview | |
parent | 635567e0564db4d19741b2478a4129fccb76f64a (diff) | |
download | qtmips-816b01b99eb770958589aadab25cd5e103917003.tar.gz qtmips-816b01b99eb770958589aadab25cd5e103917003.tar.bz2 qtmips-816b01b99eb770958589aadab25cd5e103917003.zip |
Change instruction views background to match stages color.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui/coreview')
-rw-r--r-- | qtmips_gui/coreview/instructionview.cpp | 6 | ||||
-rw-r--r-- | qtmips_gui/coreview/instructionview.h | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/qtmips_gui/coreview/instructionview.cpp b/qtmips_gui/coreview/instructionview.cpp index 6897e76..d5dbba6 100644 --- a/qtmips_gui/coreview/instructionview.cpp +++ b/qtmips_gui/coreview/instructionview.cpp @@ -49,11 +49,11 @@ using namespace coreview; #define PENW 1 ////////////////////// -InstructionView::InstructionView() : QGraphicsObject(nullptr), text(this) { +InstructionView::InstructionView(QColor bgnd) : QGraphicsObject(nullptr), text(this) { QFont f; f.setPointSize(FontSize::SIZE6); text.setFont(f); - + this->bgnd = bgnd; // Initialize to NOP instruction_update(machine::Instruction(), 0, machine::EXCAUSE_NONE); } @@ -65,7 +65,7 @@ QRectF InstructionView::boundingRect() const { void InstructionView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) { painter->setPen(QPen(QColor(240, 240, 240))); if (excause == machine::EXCAUSE_NONE) - painter->setBrush(QBrush(QColor(240, 240, 240))); + painter->setBrush(QBrush(bgnd)); else painter->setBrush(QBrush(QColor(255, 100, 100))); painter->drawRoundRect(-WIDTH/2, 0, WIDTH, HEIGHT, ROUND, ROUND); diff --git a/qtmips_gui/coreview/instructionview.h b/qtmips_gui/coreview/instructionview.h index 6e39bdd..bdcaf3c 100644 --- a/qtmips_gui/coreview/instructionview.h +++ b/qtmips_gui/coreview/instructionview.h @@ -45,7 +45,7 @@ namespace coreview { class InstructionView : public QGraphicsObject { Q_OBJECT public: - InstructionView(); + InstructionView(QColor bgnd = QColor(240, 240, 240)); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); @@ -57,6 +57,7 @@ public slots: private: QGraphicsSimpleTextItem text; machine::ExceptionCause excause; + QColor bgnd; }; } |