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
splitter.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#include <QtGui>
5
6void processSize(int)
7{
8}
9
10int main()
11{
12 QWidget *parent = nullptr;
13
15 QSplitter *splitter = new QSplitter(parent);
16 QListView *listview = new QListView;
17 QTreeView *treeview = new QTreeView;
18 QTextEdit *textedit = new QTextEdit;
19 splitter->addWidget(listview);
20 splitter->addWidget(treeview);
21 splitter->addWidget(textedit);
23
24 {
25 // SAVE STATE
28 settings.setValue("splitterSizes", splitter->saveState());
30 }
31
32 {
33 // RESTORE STATE
36 splitter->restoreState(settings.value("splitterSizes").toByteArray());
38 }
39
40 return 0;
41}
The QListView class provides a list or icon view onto a model.
Definition qlistview.h:17
\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.
The QSplitter class implements a splitter widget.
Definition qsplitter.h:21
bool restoreState(const QByteArray &state)
Restores the splitter's layout to the state specified.
QByteArray saveState() const
Saves the state of the splitter's layout.
void addWidget(QWidget *widget)
Adds the given widget to the splitter's layout after all the other items.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
Definition qtextedit.h:27
The QTreeView class provides a default model/view implementation of a tree view.
Definition qtreeview.h:20
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
void processSize(int)
Definition splitter.cpp:6
int main()
Definition splitter.cpp:10
QSettings settings("MySoft", "Star Runner")
[0]