2016-09-28 19:33:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file DockView.cpp
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "DockView.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
|
|
|
|
DockView::DockView(GuiView & parent, QString const & name,
|
|
|
|
QString const & title, Qt::DockWidgetArea area,
|
|
|
|
Qt::WindowFlags flags)
|
|
|
|
: QDockWidget(&parent, flags), Dialog(parent, name, title)
|
|
|
|
{
|
|
|
|
setObjectName(name);
|
|
|
|
parent.addDockWidget(area, this);
|
|
|
|
hide();
|
|
|
|
connect(&parent, SIGNAL(bufferViewChanged()),
|
2016-11-09 22:37:35 +00:00
|
|
|
this, SLOT(onBufferViewChanged()));
|
2016-09-28 19:33:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::keyPressEvent(QKeyEvent * ev)
|
|
|
|
{
|
|
|
|
if (ev->key() == Qt::Key_Escape) {
|
|
|
|
QMainWindow * mw = static_cast<QMainWindow *>(parent());
|
|
|
|
if (!mw) {
|
|
|
|
ev->ignore();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mw->activateWindow();
|
|
|
|
mw->setFocus();
|
|
|
|
if (isFloating())
|
|
|
|
hide();
|
|
|
|
ev->accept();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-23 11:11:54 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2016-09-28 19:33:44 +00:00
|
|
|
|
|
|
|
#include "moc_DockView.cpp"
|