2012-11-24 13:17:21 +01:00
|
|
|
#include "subview.hpp"
|
|
|
|
|
2015-05-17 14:31:53 +02:00
|
|
|
#include <QEvent>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
2022-10-19 19:02:00 +02:00
|
|
|
#include <apps/opencs/model/world/universalid.hpp>
|
|
|
|
|
2015-05-17 14:31:53 +02:00
|
|
|
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;
|
|
|
|
}
|
2015-12-15 10:40:00 +01:00
|
|
|
|
2015-05-17 14:31:53 +02:00
|
|
|
return QDockWidget::event(event);
|
|
|
|
}
|
|
|
|
|
2014-10-12 23:42:44 +02:00
|
|
|
CSVDoc::SubView::SubView(const CSMWorld::UniversalId& id)
|
2014-10-27 09:51:55 +01:00
|
|
|
: mUniversalId(id)
|
2012-11-24 13:17:21 +01:00
|
|
|
{
|
|
|
|
/// \todo add a button to the title bar that clones this sub view
|
|
|
|
|
2014-03-21 11:56:48 +01:00
|
|
|
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
|
2014-09-12 16:45:21 +02:00
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
2012-11-24 13:17:21 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 13:22:43 +01:00
|
|
|
CSMWorld::UniversalId CSVDoc::SubView::getUniversalId() const
|
2012-11-24 13:17:21 +01:00
|
|
|
{
|
|
|
|
return mUniversalId;
|
|
|
|
}
|
2013-06-15 06:40:18 -05:00
|
|
|
|
2014-03-02 13:29:02 +01:00
|
|
|
void CSVDoc::SubView::setStatusBar(bool show) {}
|
|
|
|
|
2014-03-12 13:04:40 +01:00
|
|
|
void CSVDoc::SubView::useHint(const std::string& hint) {}
|
|
|
|
|
|
|
|
void CSVDoc::SubView::setUniversalId(const CSMWorld::UniversalId& id)
|
|
|
|
{
|
|
|
|
mUniversalId = id;
|
2015-03-16 15:45:41 +01:00
|
|
|
setWindowTitle(QString::fromUtf8(mUniversalId.toString().c_str()));
|
2015-06-27 13:47:07 +02:00
|
|
|
emit universalIdChanged(mUniversalId);
|
2014-04-22 22:19:53 -05:00
|
|
|
}
|
2014-09-23 17:01:08 +10:00
|
|
|
|
|
|
|
void CSVDoc::SubView::closeEvent(QCloseEvent* event)
|
|
|
|
{
|
2016-02-01 12:12:14 +01:00
|
|
|
emit updateSubViewIndices(this);
|
2014-09-23 17:01:08 +10:00
|
|
|
}
|
2014-10-25 18:13:56 +02:00
|
|
|
|
2014-10-27 08:57:18 +01:00
|
|
|
std::string CSVDoc::SubView::getTitle() const
|
|
|
|
{
|
|
|
|
return mUniversalId.toString();
|
|
|
|
}
|
|
|
|
|
2014-10-25 18:13:56 +02:00
|
|
|
void CSVDoc::SubView::closeRequest()
|
|
|
|
{
|
|
|
|
emit closeRequest(this);
|
2014-10-31 21:50:57 +11:00
|
|
|
}
|