#include <QLayout>
#include <QLabel>
#include <QEvent>
-#include <QKeyEvent>
#include <QTimer>
#include <math.h>
#include <QGridLayout>
#include <QLabel>
#include <QEvent>
-#include <QKeyEvent>
#include <cfloat>
#include <climits>
QString aToolTip = toolTip();
if (!aKeys.isEmpty()) {
aToolTip = QString("%1 (%2)").arg(aToolTip).arg(aKeys.toString());
+ aButton->setShortcut(aKeys);
}
if (!aToolTip.isEmpty()) {
aButton->setToolTip(aToolTip);
XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent)
: QObject(theParent)
{
- // listen to Escape signal to stop the current operation
- qApp->installEventFilter(this);
}
XGUI_OperationMgr::~XGUI_OperationMgr()
{
if (theEvent->type() == QEvent::KeyRelease) {
QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
- if(aKeyEvent && onKeyReleased(aKeyEvent)) {
- return true;
+ if(aKeyEvent) {
+ return onKeyReleased(aKeyEvent);
}
}
return QObject::eventFilter(theObject, theEvent);
ModuleBase_Operation* anOperation = currentOperation();
bool isAccepted = true;
switch (theEvent->key()) {
- case Qt::Key_Escape: {
- onAbortOperation();
- }
- break;
case Qt::Key_Return:
case Qt::Key_Enter: {
commitOperation();
aBtn->setToolTip(tr("Cancel"));
aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
aBtn->setFlat(true);
+ aBtn->setShortcut(QKeySequence(Qt::Key_Escape));
aBtnLay->addWidget(aBtn);
myCustomWidget = new QWidget(aContent);
hidePropertyPanel(); //<! Invisible by default
hideObjectBrowser();
aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
+ myPropertyPanel->installEventFilter(myOperationMgr);
QPushButton* aOkBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));