Warning, /education/labplot/src/kdefrontend/worksheet/DynamicPresenterWidget_mac.mm is written in an unsupported language. File is not indexed.
0001 /*************************************************************************** 0002 File : DynamicPresenterWidget_mac.mm 0003 Project : LabPlot 0004 Description : Reimplementation of QWidget::closeEvent() to workaround QTBUG-46701 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2019 by Alexander Semke (alexander.semke@web.de) 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 * This program is distributed in the hope that it will be useful, * 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0019 * GNU General Public License for more details. * 0020 * * 0021 * You should have received a copy of the GNU General Public License * 0022 * along with this program; if not, write to the Free Software * 0023 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0024 * Boston, MA 02110-1301 USA * 0025 * * 0026 ***************************************************************************/ 0027 #include "DynamicPresenterWidget.h" 0028 #include <AppKit/AppKit.h> 0029 0030 //After closing a widget/window where showFullScreen() was called before, we are left on macOS 0031 //with a black screen (https://bugreports.qt.io/browse/QTBUG-46701). 0032 //Explicitly close the native window to workaround this problem. 0033 0034 void DynamicPresenterWidget::closeEvent(QCloseEvent* event) { 0035 QWidget::closeEvent(event); 0036 0037 NSView* view = reinterpret_cast<NSView*>(winId()); 0038 if (view == nil) 0039 return; 0040 0041 NSWindow* window = view.window; 0042 if (window == nil) 0043 return; 0044 0045 [window close]; 0046 }