From da02859cc43795af3ac35451d4662b133f9f912b Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 3 Dec 2006 20:42:15 +0100 Subject: [PATCH] Simplify slots that handle pointer expansions. QListViewItems know their parent widget, so it is not necessary to have separate slots for the expansion handlers for the Locals and Watches windows. --- kdbg/debugger.cpp | 17 ++++------------- kdbg/debugger.h | 4 +--- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/kdbg/debugger.cpp b/kdbg/debugger.cpp index 24b6035..354a5f6 100644 --- a/kdbg/debugger.cpp +++ b/kdbg/debugger.cpp @@ -49,9 +49,9 @@ KDebugger::KDebugger(QWidget* parent, m_brkpts.setAutoDelete(true); connect(&m_localVariables, SIGNAL(expanded(QListViewItem*)), - SLOT(slotLocalsExpanding(QListViewItem*))); + SLOT(slotExpanding(QListViewItem*))); connect(&m_watchVariables, SIGNAL(expanded(QListViewItem*)), - SLOT(slotWatchExpanding(QListViewItem*))); + SLOT(slotExpanding(QListViewItem*))); connect(&m_localVariables, SIGNAL(editValueCommitted(VarTree*, const QString&)), SLOT(slotValueEdited(VarTree*, const QString&))); connect(&m_watchVariables, SIGNAL(editValueCommitted(VarTree*, const QString&)), @@ -1792,22 +1792,13 @@ CmdQueueItem* KDebugger::loadCoreFile() return m_d->queueCmd(DCcorefile, m_corefile, DebuggerDriver::QMoverride); } -void KDebugger::slotLocalsExpanding(QListViewItem* item) -{ - exprExpandingHelper(&m_localVariables, item); -} - -void KDebugger::slotWatchExpanding(QListViewItem* item) -{ - exprExpandingHelper(&m_watchVariables, item); -} - -void KDebugger::exprExpandingHelper(ExprWnd* wnd, QListViewItem* item) +void KDebugger::slotExpanding(QListViewItem* item) { VarTree* exprItem = static_cast(item); if (exprItem->m_varKind != VarTree::VKpointer) { return; } + ExprWnd* wnd = static_cast(item->listView()); dereferencePointer(wnd, exprItem, true); } diff --git a/kdbg/debugger.h b/kdbg/debugger.h index 0abc2c6..7390549 100644 --- a/kdbg/debugger.h +++ b/kdbg/debugger.h @@ -370,7 +370,6 @@ protected: void evalExpressions(); void evalInitialStructExpression(VarTree* var, ExprWnd* wnd, bool immediate); void evalStructExpression(VarTree* var, ExprWnd* wnd, bool immediate); - void exprExpandingHelper(ExprWnd* wnd, QListViewItem* item); void dereferencePointer(ExprWnd* wnd, VarTree* var, bool immediate); void determineType(ExprWnd* wnd, VarTree* var); void queueMemoryDump(bool immediate); @@ -415,8 +414,7 @@ protected slots: void slotInferiorRunning(); void backgroundUpdate(); void gotoFrame(int); - void slotLocalsExpanding(QListViewItem*); - void slotWatchExpanding(QListViewItem*); + void slotExpanding(QListViewItem*); void slotDeleteWatch(); void slotValuePopup(const QString&); void slotDisassemble(const QString&, int); -- 2.11.4.GIT