From 88b5035d0e4b2377d478a3c3cf98f2685ad0f618 Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 18 Sep 2024 18:38:06 +0000 Subject: [PATCH 1/2] Makes the packages combo box searchable --- ui/trace_window.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/trace_window.cpp b/ui/trace_window.cpp index c59b7d2f5..c850e2bd7 100644 --- a/ui/trace_window.cpp +++ b/ui/trace_window.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -96,6 +98,13 @@ TraceDialog::TraceDialog(QWidget *parent) m_pkg_box->setMinimumSize(m_dev_box->sizeHint()); m_pkg_box->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon); + m_pkg_box->setEditable(true); + QSortFilterProxyModel* filterModel = new QSortFilterProxyModel(m_pkg_box); + filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); + filterModel->setSourceModel(m_pkg_box->model()); + QCompleter* completer = new QCompleter(filterModel, m_pkg_box); + completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion); + m_pkg_box->setCompleter(completer); m_app_type_box->setModel(m_app_type_model); @@ -147,6 +156,7 @@ TraceDialog::TraceDialog(QWidget *parent) SIGNAL(currentIndexChanged(const QString &)), this, SLOT(OnPackageSelected(const QString &))); + QObject::connect(m_pkg_box->lineEdit(), &QLineEdit::textEdited, filterModel, &QSortFilterProxyModel::setFilterFixedString); QObject::connect(m_run_button, &QPushButton::clicked, this, &TraceDialog::OnStartClicked); QObject::connect(m_capture_button, &QPushButton::clicked, this, &TraceDialog::OnTraceClicked); From 2c3a405c1ce725a8efc005f585920d0789d4f0bd Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 18 Sep 2024 18:38:45 +0000 Subject: [PATCH 2/2] Formatting --- ui/trace_window.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/trace_window.cpp b/ui/trace_window.cpp index c850e2bd7..ee4b1cb99 100644 --- a/ui/trace_window.cpp +++ b/ui/trace_window.cpp @@ -17,6 +17,7 @@ #include "trace_window.h" #include +#include #include #include #include @@ -25,10 +26,9 @@ #include #include #include +#include #include #include -#include -#include #include #include #include @@ -99,10 +99,10 @@ TraceDialog::TraceDialog(QWidget *parent) m_pkg_box->setSizeAdjustPolicy( QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon); m_pkg_box->setEditable(true); - QSortFilterProxyModel* filterModel = new QSortFilterProxyModel(m_pkg_box); + QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(m_pkg_box); filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); filterModel->setSourceModel(m_pkg_box->model()); - QCompleter* completer = new QCompleter(filterModel, m_pkg_box); + QCompleter *completer = new QCompleter(filterModel, m_pkg_box); completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion); m_pkg_box->setCompleter(completer); @@ -156,7 +156,10 @@ TraceDialog::TraceDialog(QWidget *parent) SIGNAL(currentIndexChanged(const QString &)), this, SLOT(OnPackageSelected(const QString &))); - QObject::connect(m_pkg_box->lineEdit(), &QLineEdit::textEdited, filterModel, &QSortFilterProxyModel::setFilterFixedString); + QObject::connect(m_pkg_box->lineEdit(), + &QLineEdit::textEdited, + filterModel, + &QSortFilterProxyModel::setFilterFixedString); QObject::connect(m_run_button, &QPushButton::clicked, this, &TraceDialog::OnStartClicked); QObject::connect(m_capture_button, &QPushButton::clicked, this, &TraceDialog::OnTraceClicked);