Commit f0b6adce authored by Victor Poughon's avatar Victor Poughon

ENH: Add CTRL+Q shortcut to QtWidgetViews

parent 2dc562e6
......@@ -33,6 +33,7 @@
// Qt includes (sorted by alphabetic order)
//// Must be included before system/custom includes.
#include <QtGui>
#include <QShortcut>
//
// System includes (sorted by alphabetic order)
......@@ -199,6 +200,7 @@ private:
QPushButton* m_ExecButton;
QPushButton* m_QuitButton;
QShortcut* m_QuitShortcut;
QLabel* m_Message;
bool m_IsClosable : 1;
......
......@@ -300,6 +300,11 @@ QtWidgetView
SLOT( close() )
);
// Add Ctrl-Q shortcut to quit
m_QuitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this);
connect( m_QuitShortcut, SIGNAL(activated()), this, SLOT(close()) );
// Put the buttons on the right
footerLayout->addStretch();
footerLayout->addWidget(m_ExecButton);
......
......@@ -20,6 +20,7 @@
#include <QtGui>
#include <QObject>
#include <QShortcut>
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility
#include "otbWrapperQtWidgetModel.h"
#endif //tag=QT4-boost-compatibility
......@@ -80,6 +81,7 @@ private:
QPushButton* m_ExecButton;
QPushButton* m_QuitButton;
QShortcut* m_QuitShortcut;
QLabel* m_Message;
};
......
......@@ -27,6 +27,7 @@
#include "itksys/SystemTools.hxx"
namespace otb
{
namespace Wrapper
......@@ -142,6 +143,10 @@ QWidget* QtWidgetView::CreateFooter()
m_QuitButton->setText(QObject::tr("Quit"));
connect( m_QuitButton, SIGNAL(clicked()), this, SLOT(CloseSlot()) );
// Add Ctrl-Q shortcut to quit
m_QuitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this);
connect( m_QuitShortcut, SIGNAL(activated()), this, SLOT(CloseSlot()) );
// Put the buttons on the right
footerLayout->addStretch();
footerLayout->addWidget(m_ExecButton);
......
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