From 0ab98fe58db00e68a0101e5fd7fb0e49678749dc Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 26 Sep 2010 18:23:04 +0200 Subject: [PATCH] Assorted cleanups around the source window. Since the conversion to QTextEdit (long ago), no copy of the text would have to be stored in the line descriptor array. Remove it. QHelpEvent has a globalPos(); do not compute it manually. --- kdbg/sourcewnd.cpp | 7 ------- kdbg/sourcewnd.h | 1 - kdbg/winstack.cpp | 6 +++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/kdbg/sourcewnd.cpp b/kdbg/sourcewnd.cpp index 18243af..411e006 100644 --- a/kdbg/sourcewnd.cpp +++ b/kdbg/sourcewnd.cpp @@ -64,7 +64,6 @@ SourceWindow::~SourceWindow() bool SourceWindow::loadFile() { - // first we load the code into QTextEdit QFile f(m_fileName); if (!f.open(QIODevice::ReadOnly)) { return false; @@ -74,12 +73,10 @@ bool SourceWindow::loadFile() setText(t.read()); f.close(); - // then we copy it into our own m_sourceCode int n = paragraphs(); m_sourceCode.resize(n); m_rowToLine.resize(n); for (int i = 0; i < n; i++) { - m_sourceCode[i].code = text(i); m_rowToLine[i] = i; } m_lineItems.resize(n, 0); @@ -99,7 +96,6 @@ void SourceWindow::reloadFile() return; } - // read text into m_sourceCode m_sourceCode.clear(); /* clear old text */ Q3TextStream t(&f); @@ -107,9 +103,6 @@ void SourceWindow::reloadFile() f.close(); m_sourceCode.resize(paragraphs()); - for (size_t i = 0; i < m_sourceCode.size(); i++) { - m_sourceCode[i].code = text(i); - } // expanded lines are collapsed: move existing line items up for (size_t i = 0; i < m_lineItems.size(); i++) { if (m_rowToLine[i] != int(i)) { diff --git a/kdbg/sourcewnd.h b/kdbg/sourcewnd.h index a5c4844..4c906fc 100644 --- a/kdbg/sourcewnd.h +++ b/kdbg/sourcewnd.h @@ -87,7 +87,6 @@ protected: }; struct SourceLine { - QString code; /* a line of text */ std::vector disass; /* its disassembled code */ std::vector disassAddr; /* the addresses thereof */ bool canDisass; /* if line can be disassembled */ diff --git a/kdbg/winstack.cpp b/kdbg/winstack.cpp index 8841b5f..89ea17b 100644 --- a/kdbg/winstack.cpp +++ b/kdbg/winstack.cpp @@ -250,11 +250,11 @@ bool WinStack::event(QEvent* evt) if (w == 0) return true; - QPoint p = static_cast(evt)->pos(); + QPoint p = static_cast(evt)->globalPos(); // get the word at the point QString word; QRect r; - if (!w->wordAtPoint(w->mapFrom(this, p), word, r)) { + if (!w->wordAtPoint(w->mapFromGlobal(p), word, r)) { QToolTip::hideText(); return true; } @@ -264,7 +264,7 @@ bool WinStack::event(QEvent* evt) assert(r.isValid()); // remember the location - m_tipLocation = mapToGlobal(p); + m_tipLocation = p; m_tipRegion = QRect(w->mapTo(this, r.topLeft()), r.size()); emit initiateValuePopup(word); -- 2.11.4.GIT