tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / vcl / qt5 / QtMainWindow.cxx
blob763a43e3dded40eaa30f1835a8000bb1b56c7379
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 <QtMainWindow.hxx>
12 #include <QtMainWindow.moc>
13 #include <QtAccessibleWidget.hxx>
15 #include <QtGui/QAccessible>
16 #include <QtGui/QCloseEvent>
18 QtMainWindow::QtMainWindow(QtFrame& rFrame, Qt::WindowFlags f)
19 : QMainWindow(nullptr, f)
20 , m_rFrame(rFrame)
22 #ifndef EMSCRIPTEN
23 QAccessible::installFactory(QtAccessibleWidget::customFactory);
24 #endif
27 void QtMainWindow::closeEvent(QCloseEvent* pEvent)
29 bool bRet = false;
30 bRet = m_rFrame.CallCallback(SalEvent::Close, nullptr);
32 if (bRet)
33 pEvent->accept();
34 // SalEvent::Close returning false may mean that user has vetoed
35 // closing the frame ("you have unsaved changes" dialog for example)
36 // We shouldn't process the event in such case
37 else
38 pEvent->ignore();
41 void QtMainWindow::moveEvent(QMoveEvent* pEvent) { m_rFrame.handleMoveEvent(pEvent); }