Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5void MyMainWindow::closeEvent(QCloseEvent *event)
6{
7 QSettings settings("MyCompany", "MyApp");
8 settings.setValue("geometry", saveGeometry());
9 settings.setValue("windowState", saveState());
11}
13
14
17{
18 QSettings settings("MyCompany", "MyApp");
19 restoreGeometry(settings.value("myWidget/geometry").toByteArray());
20 restoreState(settings.value("myWidget/windowState").toByteArray());
21}
void readSettings()
[16]
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:562
\inmodule QtCore
Definition qsettings.h:30
void setValue(QAnyStringView key, const QVariant &value)
Sets the value of setting key to value.
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
virtual void closeEvent(QCloseEvent *event)
This event handler is called with the given event when Qt receives a window close request for a top-l...
Definition qwidget.cpp:9856
struct _cl_event * event
QSettings settings("MySoft", "Star Runner")
[0]
myWidget restoreGeometry(settings.value("myWidget/geometry").toByteArray())