1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #include <Qt5MainWindow.hxx>
12 #include <Qt5MainWindow.moc>
13 #include <Qt5AccessibleWidget.hxx>
15 #include <QtGui/QAccessible>
16 #include <QtGui/QCloseEvent>
18 Qt5MainWindow::Qt5MainWindow(Qt5Frame
& rFrame
, Qt::WindowFlags f
)
19 : QMainWindow(nullptr, f
)
22 QAccessible::installFactory(Qt5AccessibleWidget::customFactory
);
25 void Qt5MainWindow::closeEvent(QCloseEvent
* pEvent
)
28 bRet
= m_rFrame
.CallCallback(SalEvent::Close
, nullptr);
32 // SalEvent::Close returning false may mean that user has vetoed
33 // closing the frame ("you have unsaved changes" dialog for example)
34 // We shouldn't process the event in such case
39 void Qt5MainWindow::moveEvent(QMoveEvent
* pEvent
)
41 const qreal fRatio
= m_rFrame
.devicePixelRatioF();
42 m_rFrame
.maGeometry
.nX
= round(pEvent
->pos().x() * fRatio
);
43 m_rFrame
.maGeometry
.nY
= round(pEvent
->pos().y() * fRatio
);
44 m_rFrame
.CallCallback(SalEvent::Move
, nullptr);