1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 23:23:54 +00:00
openmw/apps/opencs/view/doc/subview.cpp

61 lines
1.4 KiB
C++
Raw Normal View History

#include "subview.hpp"
#include <QEvent>
#include <QKeyEvent>
2022-10-19 17:02:00 +00:00
#include <apps/opencs/model/world/universalid.hpp>
2022-09-22 18:26:05 +00:00
bool CSVDoc::SubView::event(QEvent* event)
{
2022-09-22 18:26:05 +00:00
if (event->type() == QEvent::ShortcutOverride)
{
2022-09-22 18:26:05 +00:00
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
2022-09-22 18:26:05 +00:00
if (keyEvent->key() == Qt::Key_W && keyEvent->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier))
emit closeRequest();
2022-09-22 18:26:05 +00:00
return true;
}
2022-09-22 18:26:05 +00:00
return QDockWidget::event(event);
}
2022-09-22 18:26:05 +00:00
CSVDoc::SubView::SubView(const CSMWorld::UniversalId& id)
: mUniversalId(id)
{
/// \todo add a button to the title bar that clones this sub view
2022-09-22 18:26:05 +00:00
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
2014-09-12 14:45:21 +00:00
setAttribute(Qt::WA_DeleteOnClose);
}
2012-12-11 12:22:43 +00:00
CSMWorld::UniversalId CSVDoc::SubView::getUniversalId() const
{
return mUniversalId;
}
2022-09-22 18:26:05 +00:00
void CSVDoc::SubView::setStatusBar(bool show) {}
2022-09-22 18:26:05 +00:00
void CSVDoc::SubView::useHint(const std::string& hint) {}
2022-09-22 18:26:05 +00:00
void CSVDoc::SubView::setUniversalId(const CSMWorld::UniversalId& id)
{
mUniversalId = id;
2022-09-22 18:26:05 +00:00
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
emit universalIdChanged(mUniversalId);
}
2022-09-22 18:26:05 +00:00
void CSVDoc::SubView::closeEvent(QCloseEvent* event)
{
2022-09-22 18:26:05 +00:00
emit updateSubViewIndices(this);
}
std::string CSVDoc::SubView::getTitle() const
{
return mUniversalId.toString();
}
void CSVDoc::SubView::closeRequest()
{
2022-09-22 18:26:05 +00:00
emit closeRequest(this);
}