summaryrefslogtreecommitdiff
path: root/src/plugins/debugger
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-01-14 13:40:00 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-01-14 14:45:20 +0000
commit9c77515b211b04a5fe81abb4487c20d8095e253e (patch)
treea099e927e10220d00d7c17c5714026e36e9015b2 /src/plugins/debugger
parentae3b9042c96f195500cb9e89b21a9e8f5d70345a (diff)
downloadqt-creator-9c77515b211b04a5fe81abb4487c20d8095e253e.tar.gz
Debugger: Improve UnstartedAppWatcherDialog.
Make it possible to ESC out of it by using a QDialogButtonBox and overriding the ESC shortcut. Also remove context help button. Change-Id: If632c5f3cadc012dd2f67dcb709570f7a9c25bf5 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r--src/plugins/debugger/unstartedappwatcherdialog.cpp32
-rw-r--r--src/plugins/debugger/unstartedappwatcherdialog.h3
2 files changed, 21 insertions, 14 deletions
diff --git a/src/plugins/debugger/unstartedappwatcherdialog.cpp b/src/plugins/debugger/unstartedappwatcherdialog.cpp
index 6a6b5cffc5..7e4e268a8c 100644
--- a/src/plugins/debugger/unstartedappwatcherdialog.cpp
+++ b/src/plugins/debugger/unstartedappwatcherdialog.cpp
@@ -49,6 +49,8 @@
#include <QHBoxLayout>
#include <QPushButton>
#include <QCheckBox>
+#include <QDialogButtonBox>
+#include <QKeyEvent>
#include <QLabel>
#include <QFormLayout>
#include <QLineEdit>
@@ -84,6 +86,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Attach to Process Not Yet Started"));
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_kitChooser = new DebuggerKitChooser(DebuggerKitChooser::LocalDebugging, this);
m_kitChooser->populate();
@@ -124,19 +127,11 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_waitingLabel = new QLabel(QString(), this);
m_waitingLabel->setAlignment(Qt::AlignCenter);
- m_watchingPushButton = new QPushButton(this);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
+ m_watchingPushButton = buttonBox->addButton(tr("Start Watching"), QDialogButtonBox::ActionRole);
m_watchingPushButton->setCheckable(true);
m_watchingPushButton->setChecked(false);
m_watchingPushButton->setEnabled(false);
- m_watchingPushButton->setText(tr("Start Watching"));
-
- m_closePushButton = new QPushButton(this);
- m_closePushButton->setText(tr("Close"));
-
- QHBoxLayout *buttonsLine = new QHBoxLayout();
- buttonsLine->addSpacerItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
- buttonsLine->addWidget(m_watchingPushButton);
- buttonsLine->addWidget(m_closePushButton);
QFormLayout *mainLayout = new QFormLayout(this);
mainLayout->addRow(new QLabel(tr("Kit: "), this), m_kitChooser);
@@ -145,7 +140,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
mainLayout->addRow(m_continueOnAttachCheckBox);
mainLayout->addRow(m_waitingLabel);
mainLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
- mainLayout->addRow(buttonsLine);
+ mainLayout->addRow(buttonBox);
setLayout(mainLayout);
connect(m_pathChooser, &Utils::PathChooser::beforeBrowsing,
@@ -154,8 +149,7 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
this, &UnstartedAppWatcherDialog::startStopWatching);
connect(m_pathChooser, &Utils::PathChooser::pathChanged, this,
&UnstartedAppWatcherDialog::stopAndCheckExecutable);
- connect(m_closePushButton, &QAbstractButton::clicked,
- this, &QDialog::reject);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(&m_timer, &QTimer::timeout,
this, &UnstartedAppWatcherDialog::findProcess);
connect(m_kitChooser, &KitChooser::currentIndexChanged,
@@ -165,6 +159,18 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
setWaitingState(checkExecutableString() ? NotWatchingState : InvalidWacherState);
}
+bool UnstartedAppWatcherDialog::event(QEvent *e)
+{
+ if (e->type() == QEvent::ShortcutOverride) {
+ QKeyEvent *ke = static_cast<QKeyEvent *>(e);
+ if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
+ ke->accept();
+ return true;
+ }
+ }
+ return QDialog::event(e);
+}
+
void UnstartedAppWatcherDialog::selectExecutable()
{
QString path;
diff --git a/src/plugins/debugger/unstartedappwatcherdialog.h b/src/plugins/debugger/unstartedappwatcherdialog.h
index 5edb21781f..583db95ce5 100644
--- a/src/plugins/debugger/unstartedappwatcherdialog.h
+++ b/src/plugins/debugger/unstartedappwatcherdialog.h
@@ -64,6 +64,8 @@ public:
bool continueOnAttach() const;
void startWatching();
+ bool event(QEvent *) override;
+
signals:
void processFound();
@@ -93,7 +95,6 @@ private:
QCheckBox *m_hideOnAttachCheckBox;
QCheckBox *m_continueOnAttachCheckBox;
QPushButton *m_watchingPushButton;
- QPushButton *m_closePushButton;
ProjectExplorer::DeviceProcessItem m_process;
QTimer m_timer;
};