Qt
6.x
The Qt SDK
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
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);
30
}
31
32
}
//textdocument_lists
QTextCursor
\reentrant \inmodule QtGui
Definition
qtextcursor.h:30
QTextEdit
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
Definition
qtextedit.h:27
QTextEdit::textCursor
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
Definition
qtextedit.cpp:836
QTextListFormat
\reentrant
Definition
qtextformat.h:723
QTextListFormat::setStyle
void setStyle(Style style)
Sets the list format's style.
Definition
qtextformat.h:767
QTextListFormat::ListDisc
@ ListDisc
Definition
qtextformat.h:730
QTextListFormat::setIndent
void setIndent(int indent)
Sets the list format's indentation.
Definition
qtextformat.h:770
QTextListFormat::indent
int indent() const
Returns the list format's indentation.
Definition
qtextformat.h:746
QTextList
\reentrant
Definition
qtextlist.h:18
cursor
QCursor cursor
Definition
doc_src_properties.cpp:25
textdocument_lists
Definition
mainwindow.cpp:6
list
QList< int > list
[14]
Definition
src_concurrent_qtconcurrentfilter.cpp:140
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 by
1.9.7