Skip to content
Snippets Groups Projects
Commit 406d35ac authored by hjk's avatar hjk
Browse files

debugger: let 'attach to running process' dialog activate the 'ok' button if

there's only one choice after filtering
parent d22438e9
No related branches found
No related tags found
No related merge requests found
...@@ -259,7 +259,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent) ...@@ -259,7 +259,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent)
connect(m_ui->filterClearToolButton, SIGNAL(clicked()), connect(m_ui->filterClearToolButton, SIGNAL(clicked()),
m_ui->filterLineEdit, SLOT(clear())); m_ui->filterLineEdit, SLOT(clear()));
connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)),
m_model, SLOT(setFilterFixedString(QString))); this, SLOT(setFilterString(QString)));
rebuildProcessList(); rebuildProcessList();
} }
...@@ -269,6 +269,17 @@ AttachExternalDialog::~AttachExternalDialog() ...@@ -269,6 +269,17 @@ AttachExternalDialog::~AttachExternalDialog()
delete m_ui; delete m_ui;
} }
void AttachExternalDialog::setFilterString(const QString &filter)
{
m_model->setFilterFixedString(filter);
// Activate the line edit if there's a unique filtered process.
QString processId;
if (m_model->rowCount(QModelIndex()) == 1)
processId = m_model->processIdAt(m_model->index(0, 0, QModelIndex()));
m_ui->pidLineEdit->setText(processId);
pidChanged(processId);
}
QPushButton *AttachExternalDialog::okButton() const QPushButton *AttachExternalDialog::okButton() const
{ {
return m_ui->buttonBox->button(QDialogButtonBox::Ok); return m_ui->buttonBox->button(QDialogButtonBox::Ok);
...@@ -284,9 +295,9 @@ void AttachExternalDialog::rebuildProcessList() ...@@ -284,9 +295,9 @@ void AttachExternalDialog::rebuildProcessList()
void AttachExternalDialog::procSelected(const QModelIndex &proxyIndex) void AttachExternalDialog::procSelected(const QModelIndex &proxyIndex)
{ {
const QString proccessId = m_model->processIdAt(proxyIndex); const QString processId = m_model->processIdAt(proxyIndex);
if (!proccessId.isEmpty()) { if (!processId.isEmpty()) {
m_ui->pidLineEdit->setText(proccessId); m_ui->pidLineEdit->setText(processId);
if (okButton()->isEnabled()) if (okButton()->isEnabled())
okButton()->animateClick(); okButton()->animateClick();
} }
......
...@@ -95,6 +95,7 @@ private slots: ...@@ -95,6 +95,7 @@ private slots:
void rebuildProcessList(); void rebuildProcessList();
void procSelected(const QModelIndex &); void procSelected(const QModelIndex &);
void pidChanged(const QString &); void pidChanged(const QString &);
void setFilterString(const QString &filter);
private: private:
inline QPushButton *okButton() const; inline QPushButton *okButton() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment