X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2Fwidgets%2FBasicBlockWidget.cxx;h=0377be3fa2b31882d7a342c75b972eef68b87d40;hp=2003458d8733a2deb3e7e15d4b5a426209833c0c;hb=fd23bef07ee9d7adb3337d095f78adc6e0b18078;hpb=4bcd18ed3dc3450d014351f5b27d1c7d1596601c diff --git a/src/gui/widgets/BasicBlockWidget.cxx b/src/gui/widgets/BasicBlockWidget.cxx index 2003458..0377be3 100644 --- a/src/gui/widgets/BasicBlockWidget.cxx +++ b/src/gui/widgets/BasicBlockWidget.cxx @@ -5,16 +5,24 @@ BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block) , name(name), block(block) , _proxy(this) { next[0] = NULL; next[1] = NULL; - _proxy.setWidget(&_widget); - _widget.setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::LinksAccessibleByMouse); + _widget.setStyleSheet("QTableWidget { background-color : #ddddff; }"); + _widget.setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); + _widget.verticalHeader()->setDefaultSectionSize(18); + _widget.setColumnCount(3); + _widget.verticalHeader()->hide(); + _widget.horizontalHeader()->hide(); + _widget.setShowGrid(false); + _widget.setWordWrap(false); + _widget.setMinimumSize(210, 20); + _proxy.setWidget(&_widget); _proxy.setPos(5, 20); - if (width < 270) width = 270; + if (width < 250) width = 250; } void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes, - const QString& line) { + QString line, const QString& href) { QString bytestring; for (size_t i(0); i < num_bytes; ++i) { @@ -24,21 +32,19 @@ void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes, bytestring += ' '; } - QString old_text = _widget.text(); - if (old_text == "") { - old_text = ""; - } - QString new_text = - old_text.remove("
") + - "" + bytestring + - "" + line + - "" + "" + - ""; - - _widget.setText(new_text); - _widget.resize(_widget.sizeHint().width(), _widget.sizeHint().height()); + int current_row = _widget.rowCount(); + _widget.setRowCount(1 + current_row); + _widget.setItem(current_row, 0, new QTableWidgetItem(bytestring)); + _widget.setItem(current_row, 1, new QTableWidgetItem(line.replace('\t', ' '))); +// _widget.setItem(current_row, 2, new QTableWidgetItem(href)); + + _widget.resizeColumnToContents(0); + _widget.resizeColumnToContents(1); + _widget.resizeColumnToContents(2); + width = 12 + _widget.sizeHint().width(); height = 25 + _widget.sizeHint().height(); if (width < 250) width = 250; + _widget.resize(width - 12, height - 25); }