From 3c029d26a1c65aaf7ee47144b1939f62703c04cf Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 3 Dec 2006 20:14:29 +0100 Subject: [PATCH] Change ValueEdit widget to remember the item instead of the row number. This will be needed for the QListView transition. --- kdbg/dbgmainwnd.cpp | 2 +- kdbg/debugger.cpp | 15 +++++++-------- kdbg/debugger.h | 2 +- kdbg/exprwnd.cpp | 11 ++++++----- kdbg/exprwnd.h | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/kdbg/dbgmainwnd.cpp b/kdbg/dbgmainwnd.cpp index d850db9..ab92805 100644 --- a/kdbg/dbgmainwnd.cpp +++ b/kdbg/dbgmainwnd.cpp @@ -809,7 +809,7 @@ void DebuggerMainWnd::slotEditValue() // determine the text to edit VarTree* expr = static_cast(wnd->itemAt(idx)); QString text = m_debugger->driver()->editableValue(expr); - wnd->editValue(idx, text); + wnd->editValue(expr, text); } } diff --git a/kdbg/debugger.cpp b/kdbg/debugger.cpp index 233cf01..c87aa66 100644 --- a/kdbg/debugger.cpp +++ b/kdbg/debugger.cpp @@ -52,10 +52,10 @@ KDebugger::KDebugger(QWidget* parent, SLOT(slotLocalsExpanding(KTreeViewItem*,bool&))); connect(&m_watchVariables, SIGNAL(expanding(KTreeViewItem*,bool&)), SLOT(slotWatchExpanding(KTreeViewItem*,bool&))); - connect(&m_localVariables, SIGNAL(editValueCommitted(int, const QString&)), - SLOT(slotValueEdited(int, const QString&))); - connect(&m_watchVariables, SIGNAL(editValueCommitted(int, const QString&)), - SLOT(slotValueEdited(int, const QString&))); + connect(&m_localVariables, SIGNAL(editValueCommitted(VarTree*, const QString&)), + SLOT(slotValueEdited(VarTree*, const QString&))); + connect(&m_watchVariables, SIGNAL(editValueCommitted(VarTree*, const QString&)), + SLOT(slotValueEdited(VarTree*, const QString&))); connect(&m_btWindow, SIGNAL(highlighted(int)), SLOT(gotoFrame(int))); @@ -2223,18 +2223,17 @@ void KDebugger::handleSetPC(const char* /*output*/) gotoFrame(0); } -void KDebugger::slotValueEdited(int row, const QString& text) +void KDebugger::slotValueEdited(VarTree* expr, const QString& text) { if (text.simplifyWhiteSpace().isEmpty()) return; /* no text entered: ignore request */ ASSERT(sender()->inherits("ExprWnd")); ExprWnd* wnd = const_cast(static_cast(sender())); - TRACE(QString().sprintf("Changing %s at row %d to ", - wnd->name(), row) + text); + TRACE(QString().sprintf("Changing %s to ", + wnd->name()) + text); // determine the lvalue to edit - VarTree* expr = static_cast(wnd->itemAt(row)); QString lvalue = expr->computeExpr(); CmdQueueItem* cmd = m_d->executeCmd(DCsetvariable, lvalue, text); cmd->m_expr = expr; diff --git a/kdbg/debugger.h b/kdbg/debugger.h index 89a45c5..513ca41 100644 --- a/kdbg/debugger.h +++ b/kdbg/debugger.h @@ -420,7 +420,7 @@ protected slots: void slotDeleteWatch(); void slotValuePopup(const QString&); void slotDisassemble(const QString&, int); - void slotValueEdited(int, const QString&); + void slotValueEdited(VarTree*, const QString&); public slots: void setThread(int); void shutdown(); diff --git a/kdbg/exprwnd.cpp b/kdbg/exprwnd.cpp index b6be083..8d70bc2 100644 --- a/kdbg/exprwnd.cpp +++ b/kdbg/exprwnd.cpp @@ -825,7 +825,7 @@ void ExprWnd::slotExpandOrCollapse(int) updateValuesWidth(); } -void ExprWnd::editValue(int row, const QString& text) +void ExprWnd::editValue(VarTree* item, const QString& text) { if (m_edit == 0) m_edit = new ValueEdit(this); @@ -833,6 +833,7 @@ void ExprWnd::editValue(int row, const QString& text) int x; colXPos(1, &x); int y; + int row = itemRow(item); rowYPos(row, &y); int w = cellWidth(1); int h = cellHeight(row); @@ -872,7 +873,7 @@ void ExprWnd::editValue(int row, const QString& text) m_edit->setGeometry(rect); m_edit->m_finished = false; - m_edit->m_row = row; + m_edit->m_item = item; m_edit->show(); m_edit->setFocus(); } @@ -892,8 +893,8 @@ ValueEdit::ValueEdit(ExprWnd* parent) : connect(parent, SIGNAL(selected(int)), SLOT(slotSelectionChanged())); connect(parent, SIGNAL(collapsed(int)), SLOT(slotSelectionChanged())); connect(parent, SIGNAL(expanded(int)), SLOT(slotSelectionChanged())); - connect(this, SIGNAL(done(int, const QString&)), - parent, SIGNAL(editValueCommitted(int, const QString&))); + connect(this, SIGNAL(done(VarTree*, const QString&)), + parent, SIGNAL(editValueCommitted(VarTree*, const QString&))); } ValueEdit::~ValueEdit() @@ -908,7 +909,7 @@ void ValueEdit::terminate(bool commit) m_finished = true; hide(); // will call focusOutEvent, that's why we need m_finished if (commit) { - emit done(m_row, text()); + emit done(m_item, text()); } } } diff --git a/kdbg/exprwnd.h b/kdbg/exprwnd.h index 97d7739..e7ef681 100644 --- a/kdbg/exprwnd.h +++ b/kdbg/exprwnd.h @@ -93,7 +93,7 @@ public: ~ValueEdit(); void terminate(bool commit); - int m_row; + VarTree* m_item; bool m_finished; protected: void keyPressEvent(QKeyEvent *e); @@ -102,7 +102,7 @@ protected: public slots: void slotSelectionChanged(); signals: - void done(int, const QString&); + void done(VarTree*, const QString&); }; @@ -139,7 +139,7 @@ public: VarTree* nextUpdatePtr(); VarTree* nextUpdateType(); VarTree* nextUpdateStruct(); - void editValue(int row, const QString& text); + void editValue(VarTree* item, const QString& text); /** tells whether the a value is currently edited */ bool isEditing() const; @@ -174,7 +174,7 @@ protected slots: signals: void removingItem(VarTree*); - void editValueCommitted(int, const QString&); + void editValueCommitted(VarTree*, const QString&); }; #endif // EXPRWND_H -- 2.11.4.GIT