Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_gui_widgets_qmainwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4//! [0]
5void MyMainWindow::closeEvent(QCloseEvent *event)
6{
7 QSettings settings("MyCompany", "MyApp");
8 settings.setValue("geometry", saveGeometry());
9 settings.setValue("windowState", saveState());
10 QMainWindow::closeEvent(event);
11}
12//! [0]
13
14
15//! [1]
16void MainWindow::readSettings()
17{
18 QSettings settings("MyCompany", "MyApp");
19 restoreGeometry(settings.value("myWidget/geometry").toByteArray());
20 restoreState(settings.value("myWidget/windowState").toByteArray());
21}
22//! [1]