mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
TableBottomBox: Creator/Configurator can be closed via Escape
This commit is contained in:
parent
1f826476ff
commit
880bc31ddf
2 changed files with 20 additions and 0 deletions
|
@ -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…
Reference in a new issue