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
......@@ -259,7 +259,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent)
connect(m_ui->filterClearToolButton, SIGNAL(clicked()),
m_ui->filterLineEdit, SLOT(clear()));
connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)),
m_model, SLOT(setFilterFixedString(QString)));
this, SLOT(setFilterString(QString)));
rebuildProcessList();
}
......@@ -269,6 +269,17 @@ AttachExternalDialog::~AttachExternalDialog()
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
{
return m_ui->buttonBox->button(QDialogButtonBox::Ok);
......@@ -284,9 +295,9 @@ void AttachExternalDialog::rebuildProcessList()
void AttachExternalDialog::procSelected(const QModelIndex &proxyIndex)
{
const QString proccessId = m_model->processIdAt(proxyIndex);
if (!proccessId.isEmpty()) {
m_ui->pidLineEdit->setText(proccessId);
const QString processId = m_model->processIdAt(proxyIndex);
if (!processId.isEmpty()) {
m_ui->pidLineEdit->setText(processId);
if (okButton()->isEnabled())
okButton()->animateClick();
}
......
......@@ -95,6 +95,7 @@ private slots:
void rebuildProcessList();
void procSelected(const QModelIndex &);
void pidChanged(const QString &);
void setFilterString(const QString &filter);
private:
inline QPushButton *okButton() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment