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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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>
bool CSVDoc::SubView::event(QEvent* event)
{
if (event->type() == QEvent::ShortcutOverride)
{
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_W && keyEvent->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier))
emit closeRequest();
return true;
}
return QDockWidget::event(event);
}
CSVDoc::SubView::SubView(const CSMWorld::UniversalId& id)
: mUniversalId(id)
{
/// \todo add a button to the title bar that clones this sub view
2014-03-21 10:56:48 +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;
}
void CSVDoc::SubView::setStatusBar(bool show) {}
void CSVDoc::SubView::useHint(const std::string& hint) {}
void CSVDoc::SubView::setUniversalId(const CSMWorld::UniversalId& id)
{
mUniversalId = id;
2015-03-16 14:45:41 +00:00
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
emit universalIdChanged(mUniversalId);
}
void CSVDoc::SubView::closeEvent(QCloseEvent* event)
{
emit updateSubViewIndices(this);
}
std::string CSVDoc::SubView::getTitle() const
{
return mUniversalId.toString();
}
void CSVDoc::SubView::closeRequest()
{
emit closeRequest(this);
}