From a734e1861709debea0f2aabe64cb3476d20bc9df Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 2 Dec 2006 23:24:51 +0100 Subject: [PATCH] Make the value edit window a pointer rather then a member object. This cleanup will be needed for the QListView transition. --- kdbg/exprwnd.cpp | 23 +++++++++++++---------- kdbg/exprwnd.h | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/kdbg/exprwnd.cpp b/kdbg/exprwnd.cpp index 080f0d3..b6be083 100644 --- a/kdbg/exprwnd.cpp +++ b/kdbg/exprwnd.cpp @@ -317,7 +317,7 @@ uint ExprValue::childCount() const ExprWnd::ExprWnd(QWidget* parent, const char* name) : KTreeView(parent, name), maxValueWidth(0), - m_edit(this) + m_edit(0) { setNumCols(2); @@ -827,6 +827,9 @@ void ExprWnd::slotExpandOrCollapse(int) void ExprWnd::editValue(int row, const QString& text) { + if (m_edit == 0) + m_edit = new ValueEdit(this); + int x; colXPos(1, &x); int y; @@ -841,7 +844,7 @@ void ExprWnd::editValue(int row, const QString& text) * the text, scroll this widget so that half of it shows the text (or * less than half of it if the text is shorter). */ - QFontMetrics metr = m_edit.font(); + QFontMetrics metr = m_edit->font(); int wMin = metr.width("88888"); if (w < wMin) w = wMin; @@ -864,19 +867,19 @@ void ExprWnd::editValue(int row, const QString& text) // make the edit box as wide as the visible column QRect rect(x,y, wThis-x,h); - m_edit.setText(text); - m_edit.selectAll(); + m_edit->setText(text); + m_edit->selectAll(); - m_edit.setGeometry(rect); - m_edit.m_finished = false; - m_edit.m_row = row; - m_edit.show(); - m_edit.setFocus(); + m_edit->setGeometry(rect); + m_edit->m_finished = false; + m_edit->m_row = row; + m_edit->show(); + m_edit->setFocus(); } bool ExprWnd::isEditing() const { - return m_edit.isVisible(); + return m_edit != 0 && m_edit->isVisible(); } diff --git a/kdbg/exprwnd.h b/kdbg/exprwnd.h index a1140b5..97d7739 100644 --- a/kdbg/exprwnd.h +++ b/kdbg/exprwnd.h @@ -163,7 +163,7 @@ protected: QList m_updateType; /* structs whose type must be determined */ QList m_updateStruct; /* structs whose nested value needs update */ - ValueEdit m_edit; + ValueEdit* m_edit; /** remove items that are in the subTree from the list */ void unhookSubtree(VarTree* subTree); -- 2.11.4.GIT