]> git.cworth.org Git - apitrace/blob - gui/jumpwidget.cpp
Implement jumping to a specific call.
[apitrace] / gui / jumpwidget.cpp
1 #include "jumpwidget.h"
2
3 #include <QDebug>
4
5 JumpWidget::JumpWidget(QWidget *parent )
6     : QWidget(parent)
7 {
8     m_ui.setupUi(this);
9
10     connect(m_ui.jumpButton, SIGNAL(clicked()),
11             SLOT(slotJump()));
12     connect(m_ui.spinBox, SIGNAL(editingFinished()),
13             SLOT(slotJump()));
14     connect(m_ui.cancelButton, SIGNAL(clicked()),
15             SLOT(slotCancel()));
16 }
17
18 void JumpWidget::slotJump()
19 {
20     if (isVisible()) {
21         emit jumpTo(m_ui.spinBox->value());
22     }
23     hide();
24 }
25
26 void JumpWidget::slotCancel()
27 {
28     hide();
29 }
30
31 void JumpWidget::showEvent(QShowEvent *event)
32 {
33     m_ui.spinBox->setFocus(Qt::ShortcutFocusReason);
34     return QWidget::showEvent(event);
35 }
36
37 #include "jumpwidget.moc"