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
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
8{
9 void insertList();
10
11private:
12 QTextEdit *editor = nullptr;
13};
14
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
28 cursor.insertList(listFormat);
30}
31
32} //textdocument_lists
\reentrant \inmodule QtGui
Definition qtextcursor.h:30
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
Definition qtextedit.h:27
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
void setStyle(Style style)
Sets the list format's style.
void setIndent(int indent)
Sets the list format's indentation.
int indent() const
Returns the list format's indentation.
\reentrant
Definition qtextlist.h:18
QCursor cursor
QList< int > list
[14]