From 3894c7f40260a8f5f4b47e82860ae40ec592efc1 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Mon, 23 Feb 2015 16:33:59 +0100 Subject: [PATCH] Add link handler only once for each basic block --- src/gui/widgets/BasicBlockWidget.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/BasicBlockWidget.cxx b/src/gui/widgets/BasicBlockWidget.cxx index 8e7e440..0036bda 100644 --- a/src/gui/widgets/BasicBlockWidget.cxx +++ b/src/gui/widgets/BasicBlockWidget.cxx @@ -69,6 +69,15 @@ BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block, Qt::LinksAccessibleByMouse); if (width < 250) width = 250; + + QObject::connect(_widget.get(), &QGraphicsTextItem::linkActivated, + [=](QString str) { + if (str.startsWith("function:")) { + QString address = str.remove("function:"); + mainwindow->switchMainPlaneToAddress(address.toInt(NULL, 16)); + } + }); +} } void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes, @@ -102,14 +111,6 @@ void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes, } _table->cellAt(row, 1).firstCursorPosition().insertHtml(line); - - QObject::connect(_widget.get(), &QGraphicsTextItem::linkActivated, - [=](QString str) { - if (str.startsWith("function:")) { - QString address = str.remove("function:"); - mainwindow->switchMainPlaneToAddress(address.toInt(NULL, 16)); - } - }); } void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, -- 2.39.5