aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/registersdock.cpp
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-23 15:36:48 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-23 15:39:28 +0100
commitd35a19f9d3722468dc2bb4ec7449a0cee07b3b8c (patch)
tree3c3301650a504298697be25e4c77685da251e70f /qtmips_gui/registersdock.cpp
parent2e657ea1ff3472d8a4f3706731e5533ba94f2d0d (diff)
downloadqtmips-d35a19f9d3722468dc2bb4ec7449a0cee07b3b8c.tar.gz
qtmips-d35a19f9d3722468dc2bb4ec7449a0cee07b3b8c.tar.bz2
qtmips-d35a19f9d3722468dc2bb4ec7449a0cee07b3b8c.zip
Better layout registers
This does dynamic layout of registers. This implemntation is just terrible. It works but it's almost unreadable. It's just too much code for such a small feature. But I can't be bothered to refactor it on top of hacking it.
Diffstat (limited to 'qtmips_gui/registersdock.cpp')
-rw-r--r--qtmips_gui/registersdock.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/qtmips_gui/registersdock.cpp b/qtmips_gui/registersdock.cpp
index 809b692..d9d3f2f 100644
--- a/qtmips_gui/registersdock.cpp
+++ b/qtmips_gui/registersdock.cpp
@@ -37,23 +37,23 @@ static const QString labels[] = {
RegistersDock::RegistersDock(QWidget *parent) : QDockWidget(parent) {
scrollarea = new QScrollArea(this);
- widg = new QWidget(scrollarea);
- layout = new QFormLayout(widg);
- layout->setSizeConstraint(QLayout::SetMinAndMaxSize);
+ scrollarea->setWidgetResizable(true);
+ widg = new StaticTable(scrollarea);
#define INIT(X, LABEL) do{ \
- X = new QLabel(widg); \
+ X = new QLabel("0x00000000", widg); \
+ X->setFixedSize(X->sizeHint()); \
+ X->setText(""); \
X->setTextInteractionFlags(Qt::TextSelectableByMouse); \
- layout->addRow(LABEL, X); \
+ widg->addRow({new QLabel(LABEL, widg), X}); \
} while(false)
- INIT(pc, "pc:");
for (int i = 0; i < 32; i++)
- INIT(gp[i], QString("$") + QString::number(i) + QString("/") + labels[i] + QString(":"));
- INIT(lo, "lo:");
- INIT(hi, "hi:");
+ INIT(gp[i], QString("$") + QString::number(i) + QString("/") + labels[i]);
+ INIT(pc, "pc");
+ INIT(lo, "lo");
+ INIT(hi, "hi");
#undef INIT
- widg->setLayout(layout);
scrollarea->setWidget(widg);
setWidget(scrollarea);
@@ -67,7 +67,6 @@ RegistersDock::~RegistersDock() {
delete lo;
for (int i = 0; i < 32; i++)
delete gp[i];
- delete layout;
delete widg;
delete scrollarea;
}