TableBottomBox: Creator/Configurator can be closed via Escape

sceneinput
Stanislav Bas 10 years ago
parent 1f826476ff
commit 880bc31ddf

@ -6,6 +6,8 @@
#include <QStatusBar>
#include <QStackedLayout>
#include <QLabel>
#include <QEvent>
#include <QKeyEvent>
#include "creator.hpp"
@ -92,6 +94,7 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto
if (mCreator)
{
mCreator->installEventFilter(this);
mLayout->addWidget (mCreator);
connect (mCreator, SIGNAL (done()), this, SLOT (requestDone()));
@ -101,6 +104,7 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto
}
mExtendedConfigurator = new ExtendedCommandConfigurator (document, id, this);
mExtendedConfigurator->installEventFilter(this);
mLayout->addWidget (mExtendedConfigurator);
connect (mExtendedConfigurator, SIGNAL (done()), this, SLOT (requestDone()));
@ -118,6 +122,20 @@ CSVWorld::TableBottomBox::~TableBottomBox()
delete mCreator;
}
bool CSVWorld::TableBottomBox::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Escape)
{
requestDone();
return true;
}
}
return QWidget::eventFilter(object, event);
}
void CSVWorld::TableBottomBox::setStatusBar (bool show)
{
if (show!=mShowStatusBar)

@ -59,6 +59,8 @@ namespace CSVWorld
virtual ~TableBottomBox();
virtual bool eventFilter(QObject *object, QEvent *event);
void setEditLock (bool locked);
void setStatusBar (bool show);

Loading…
Cancel
Save