nss: upgrade to release 3.73
[LibreOffice.git] / vcl / qt5 / Qt5MainWindow.cxx
blob45d726ba22be4e44277603fe4e5ade3518aa70d3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
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)
20 , m_rFrame(rFrame)
22 QAccessible::installFactory(Qt5AccessibleWidget::customFactory);
25 void Qt5MainWindow::closeEvent(QCloseEvent* pEvent)
27 bool bRet = false;
28 bRet = m_rFrame.CallCallback(SalEvent::Close, nullptr);
30 if (bRet)
31 pEvent->accept();
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
35 else
36 pEvent->ignore();
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);