diff options
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; }; } |