Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
mainwindow.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
#
include
<
QTextEdit
>
4
#
include
<
QTextList
>
5
6
namespace
textdocument_lists
{
7
struct
MainWindow
8
{
9
void
insertList
();
10
11
private
:
12
QTextEdit *editor =
nullptr
;
13
};
14
15
void
MainWindow
::
insertList
()
16
{
17
QTextCursor cursor = editor->textCursor();
18
QTextList *list = cursor.currentList();
19
20
//! [0]
21
QTextListFormat listFormat;
22
if
(list) {
23
listFormat = list->format();
24
listFormat.setIndent(listFormat.indent() + 1);
25
}
26
27
listFormat.setStyle(QTextListFormat::ListDisc);
28
cursor.insertList(listFormat);
29
//! [0]
30
}
31
32
}
//textdocument_lists
textdocument_lists
Definition
mainwindow.cpp:6
textdocument_lists::MainWindow
Definition
mainwindow.cpp:8
textdocument_lists::MainWindow::insertList
void insertList()
Definition
mainwindow.cpp:15
qtbase
src
gui
doc
snippets
textdocument-lists
mainwindow.cpp
Generated on
for Qt by
1.18.0