]> git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/BasicBlockWidget.cxx
Add horizontal space between BasicBlockWidgets
[frida/frida.git] / src / gui / widgets / BasicBlockWidget.cxx
1 #include "BasicBlockWidget.hxx"
2
3 BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block)
4 : width(270), height(45)
5 , name(name), block(block) {
6 next[0] = NULL; next[1] = NULL;
7 _widget.move(5, 20);
8 _widget.setGridStyle(Qt::NoPen);
9 _widget.setMinimumHeight(_widget.rowHeight(0) + 10);
10 _widget.setMaximumHeight(20);
11 _widget.resizeColumnToContents(0);
12 _widget.resizeColumnToContents(1);
13 _widget.resizeColumnToContents(2);
14 _widget.updateGeometry();
15 _widget.setMaximumWidth(260);
16 _widget.setColumnCount(3);
17 _widget.verticalHeader()->hide();
18 _widget.horizontalHeader()->hide();
19 width = _widget.rowHeight(0) + 20;
20 if (width < 270) width = 270;
21 }
22
23 void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes,
24 const QString& line) {
25 size_t current_row = _widget.rowCount();
26 int column_width;
27
28 QString bytestring;
29
30 for (size_t i(0); i < num_bytes; ++i) {
31 const char * hexdigits = "0123456789ABCDEF";
32 bytestring += hexdigits[(bytes[i] >> 4) & 0xF];
33 bytestring += hexdigits[bytes[i] & 0xF];
34 bytestring += ' ';
35 }
36
37 _widget.setRowCount(current_row + 1);
38
39 _widget.setItem(current_row, 0, new QTableWidgetItem(bytestring));
40 _widget.setItem(current_row, 1, new QTableWidgetItem(line));
41 _widget.setItem(current_row, 2, new QTableWidgetItem(""));
42 _widget.updateGeometry();
43
44 _widget.resizeColumnToContents(0);
45 _widget.resizeColumnToContents(1);
46 _widget.resizeColumnToContents(2);
47
48 _widget.resizeRowToContents(current_row);
49
50 column_width =
51 _widget.columnWidth(0) +
52 _widget.columnWidth(1) +
53 _widget.columnWidth(2) +
54 2;
55
56 _widget.setMinimumWidth(column_width);
57 _widget.setMinimumHeight(_widget.rowHeight(0) * (_widget.rowCount()) + 2);
58 _widget.setMaximumHeight(_widget.rowHeight(0) * (_widget.rowCount()) + 2);
59
60
61 height = _widget.rowHeight(0) * (_widget.rowCount()) + 25;
62 width = column_width + 10;
63 if (width < 270) width = 270;
64 }