From 816b01b99eb770958589aadab25cd5e103917003 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Tue, 26 Mar 2019 17:55:57 +0100 Subject: Change instruction views background to match stages color. Signed-off-by: Pavel Pisa --- qtmips_gui/coreview/instructionview.cpp | 6 +++--- qtmips_gui/coreview/instructionview.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'qtmips_gui/coreview') 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; }; } -- cgit v1.2.3