summaryrefslogtreecommitdiff
path: root/examples/triage/baseaddress.cpp
diff options
context:
space:
mode:
authorJordan Wiens <github@psifertex.com>2025-12-18 09:40:45 -0500
committerJordan Wiens <github@psifertex.com>2025-12-18 09:40:53 -0500
commit39da63b33c14cfa3f640a761fad1e27b79f9c91f (patch)
tree70dc4c8f050622d85ba8eef6cceaa43d7c1912fc /examples/triage/baseaddress.cpp
parent6138978808829172448615980742756831959788 (diff)
truncate long paths in triage view and prevent the UI from moving when starting BASE
Diffstat (limited to 'examples/triage/baseaddress.cpp')
-rw-r--r--examples/triage/baseaddress.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/triage/baseaddress.cpp b/examples/triage/baseaddress.cpp
index f32169ad..dacc6c53 100644
--- a/examples/triage/baseaddress.cpp
+++ b/examples/triage/baseaddress.cpp
@@ -1,4 +1,6 @@
#include "baseaddress.h"
+#include <QScrollArea>
+#include <QScrollBar>
using namespace std;
@@ -175,6 +177,23 @@ void BaseAddressDetectionWidget::GetClickedBaseAddress(const QModelIndex& index)
void BaseAddressDetectionWidget::HandleResults(const BaseAddressDetectionQtResults& results)
{
+ // Save scroll position to prevent unwanted scrolling when hiding/showing widgets
+ QScrollArea* scrollArea = nullptr;
+ int savedVerticalScrollPosition = 0;
+ int savedHorizontalScrollPosition = 0;
+ QWidget* ancestor = parentWidget();
+ while (ancestor)
+ {
+ scrollArea = qobject_cast<QScrollArea*>(ancestor);
+ if (scrollArea)
+ {
+ savedVerticalScrollPosition = scrollArea->verticalScrollBar()->value();
+ savedHorizontalScrollPosition = scrollArea->horizontalScrollBar()->value();
+ break;
+ }
+ ancestor = ancestor->parentWidget();
+ }
+
if (!results.Status.empty())
m_status->setText(QString::fromStdString(results.Status));
@@ -238,11 +257,35 @@ void BaseAddressDetectionWidget::HandleResults(const BaseAddressDetectionQtResul
m_abortButton->setHidden(true);
m_startButton->setHidden(false);
m_startButton->setEnabled(true);
+
+ // Restore scroll position after widget visibility changes
+ if (scrollArea)
+ {
+ scrollArea->verticalScrollBar()->setValue(savedVerticalScrollPosition);
+ scrollArea->horizontalScrollBar()->setValue(savedHorizontalScrollPosition);
+ }
}
void BaseAddressDetectionWidget::DetectBaseAddress()
{
+ // Save scroll position to prevent unwanted scrolling when hiding/showing widgets
+ QScrollArea* scrollArea = nullptr;
+ int savedVerticalScrollPosition = 0;
+ int savedHorizontalScrollPosition = 0;
+ QWidget* ancestor = parentWidget();
+ while (ancestor)
+ {
+ scrollArea = qobject_cast<QScrollArea*>(ancestor);
+ if (scrollArea)
+ {
+ savedVerticalScrollPosition = scrollArea->verticalScrollBar()->value();
+ savedHorizontalScrollPosition = scrollArea->horizontalScrollBar()->value();
+ break;
+ }
+ ancestor = ancestor->parentWidget();
+ }
+
HideResultsWidgets(true);
m_status->setText("Running...");
m_resultsTableWidget->clearContents();
@@ -254,6 +297,13 @@ void BaseAddressDetectionWidget::DetectBaseAddress()
connect(m_worker, &BaseAddressDetectionThread::finished, m_worker, &QObject::deleteLater);
m_worker->start();
m_abortButton->setHidden(false);
+
+ // Restore scroll position after widget visibility changes
+ if (scrollArea)
+ {
+ scrollArea->verticalScrollBar()->setValue(savedVerticalScrollPosition);
+ scrollArea->horizontalScrollBar()->setValue(savedHorizontalScrollPosition);
+ }
}