A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQTextList</id>
		<title>C++/Qt/QTextList - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQTextList"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextList&amp;action=history"/>
		<updated>2026-04-18T22:14:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextList&amp;diff=1042&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextList&amp;diff=1042&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextList&amp;diff=1043&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextList&amp;diff=1043&amp;oldid=prev"/>
				<updated>2010-05-25T10:24:40Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==QTextList and QTextListFormat==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/****************************************************************************&lt;br /&gt;
**&lt;br /&gt;
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;br /&gt;
** All rights reserved.&lt;br /&gt;
** Contact: Nokia Corporation (qt-info@nokia.com)&lt;br /&gt;
**&lt;br /&gt;
** This file is part of the documentation of the Qt Toolkit.&lt;br /&gt;
**&lt;br /&gt;
** $QT_BEGIN_LICENSE:LGPL$&lt;br /&gt;
** Commercial Usage&lt;br /&gt;
** Licensees holding valid Qt Commercial licenses may use this file in&lt;br /&gt;
** accordance with the Qt Commercial License Agreement provided with the&lt;br /&gt;
** Software or, alternatively, in accordance with the terms contained in&lt;br /&gt;
** a written agreement between you and Nokia.&lt;br /&gt;
**&lt;br /&gt;
** GNU Lesser General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU Lesser&lt;br /&gt;
** General Public License version 2.1 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.LGPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU Lesser General Public License version 2.1 requirements&lt;br /&gt;
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.&lt;br /&gt;
**&lt;br /&gt;
** In addition, as a special exception, Nokia gives you certain additional&lt;br /&gt;
** rights.  These rights are described in the Nokia Qt LGPL Exception&lt;br /&gt;
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.&lt;br /&gt;
**&lt;br /&gt;
** GNU General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU&lt;br /&gt;
** General Public License version 3.0 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.GPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU General Public License version 3.0 requirements will be&lt;br /&gt;
** met: http://www.gnu.org/copyleft/gpl.html.&lt;br /&gt;
**&lt;br /&gt;
** If you have questions regarding the use of this file, please contact&lt;br /&gt;
** Nokia at qt-info@nokia.com.&lt;br /&gt;
** $QT_END_LICENSE$&lt;br /&gt;
**&lt;br /&gt;
****************************************************************************/&lt;br /&gt;
#ifndef WINDOW_H&lt;br /&gt;
#define WINDOW_H&lt;br /&gt;
#include &amp;lt;QMainWindow&amp;gt;&lt;br /&gt;
#include &amp;lt;QTextDocumentFragment&amp;gt;&lt;br /&gt;
class QAction;&lt;br /&gt;
class QTextDocument;&lt;br /&gt;
class QTextEdit;&lt;br /&gt;
class MainWindow : public QMainWindow&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    MainWindow();&lt;br /&gt;
public slots:&lt;br /&gt;
    void cutSelection();&lt;br /&gt;
    void copySelection();&lt;br /&gt;
    void insertList();&lt;br /&gt;
    void pasteSelection();&lt;br /&gt;
    void selectWord();&lt;br /&gt;
    void selectLine();&lt;br /&gt;
    void selectBlock();&lt;br /&gt;
    void selectFrame();&lt;br /&gt;
    void updateMenus();&lt;br /&gt;
private:&lt;br /&gt;
    QAction *cutAction;&lt;br /&gt;
    QAction *copyAction;&lt;br /&gt;
    QAction *pasteAction;&lt;br /&gt;
    QString currentFile;&lt;br /&gt;
    QTextEdit *editor;&lt;br /&gt;
    QTextDocument *document;&lt;br /&gt;
    QTextDocumentFragment selection;&lt;br /&gt;
};&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;mainwindow.h&amp;quot;&lt;br /&gt;
MainWindow::MainWindow()&lt;br /&gt;
{&lt;br /&gt;
    QMenu *fileMenu = new QMenu(tr(&amp;quot;&amp;amp;File&amp;quot;));&lt;br /&gt;
    fileMenu-&amp;gt;addAction(tr(&amp;quot;E&amp;amp;xit&amp;quot;), this, SLOT(close()),&lt;br /&gt;
        QKeySequence(tr(&amp;quot;Ctrl+Q&amp;quot;, &amp;quot;File|Exit&amp;quot;)));&lt;br /&gt;
    QMenu *editMenu = new QMenu(tr(&amp;quot;&amp;amp;Edit&amp;quot;));&lt;br /&gt;
    cutAction = editMenu-&amp;gt;addAction(tr(&amp;quot;Cu&amp;amp;t&amp;quot;), this, SLOT(cutSelection()),&lt;br /&gt;
        QKeySequence(tr(&amp;quot;Ctrl+X&amp;quot;, &amp;quot;Edit|Cut&amp;quot;)));&lt;br /&gt;
    copyAction = editMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Copy&amp;quot;), this, SLOT(copySelection()),&lt;br /&gt;
        QKeySequence(tr(&amp;quot;Ctrl+C&amp;quot;, &amp;quot;Edit|Copy&amp;quot;)));&lt;br /&gt;
    pasteAction = editMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Paste&amp;quot;), this,&lt;br /&gt;
        SLOT(pasteSelection()), QKeySequence(tr(&amp;quot;Ctrl+V&amp;quot;, &amp;quot;Edit|Paste&amp;quot;)));&lt;br /&gt;
    QMenu *selectMenu = new QMenu(tr(&amp;quot;&amp;amp;Select&amp;quot;));&lt;br /&gt;
    selectMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Word&amp;quot;), this, SLOT(selectWord()));&lt;br /&gt;
    selectMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Line&amp;quot;), this, SLOT(selectLine()));&lt;br /&gt;
    selectMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Block&amp;quot;), this, SLOT(selectBlock()));&lt;br /&gt;
    selectMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Frame&amp;quot;), this, SLOT(selectFrame()));&lt;br /&gt;
    QMenu *insertMenu = new QMenu(tr(&amp;quot;&amp;amp;Insert&amp;quot;));&lt;br /&gt;
    insertMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;List&amp;quot;), this, SLOT(insertList()),&lt;br /&gt;
        QKeySequence(tr(&amp;quot;Ctrl+L&amp;quot;, &amp;quot;Insert|List&amp;quot;)));&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(fileMenu);&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(editMenu);&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(selectMenu);&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(insertMenu);&lt;br /&gt;
    editor = new QTextEdit(this);&lt;br /&gt;
    document = new QTextDocument(this);&lt;br /&gt;
    editor-&amp;gt;setDocument(document);&lt;br /&gt;
    connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));&lt;br /&gt;
    updateMenus();&lt;br /&gt;
    setCentralWidget(editor);&lt;br /&gt;
    setWindowTitle(tr(&amp;quot;Text Document Writer&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::cutSelection()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    if (cursor.hasSelection()) {&lt;br /&gt;
        selection = cursor.selection();&lt;br /&gt;
        cursor.removeSelectedText();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::copySelection()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    if (cursor.hasSelection()) {&lt;br /&gt;
        selection = cursor.selection();&lt;br /&gt;
        cursor.clearSelection();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::pasteSelection()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    cursor.insertFragment(selection);&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::selectWord()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    QTextBlock block = cursor.block();&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    cursor.movePosition(QTextCursor::StartOfWord);&lt;br /&gt;
    cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
    editor-&amp;gt;setTextCursor(cursor);&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::selectLine()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    QTextBlock block = cursor.block();&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    cursor.movePosition(QTextCursor::StartOfLine);&lt;br /&gt;
    cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
    editor-&amp;gt;setTextCursor(cursor);&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::selectBlock()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    QTextBlock block = cursor.block();&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    cursor.movePosition(QTextCursor::StartOfBlock);&lt;br /&gt;
    cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
    editor-&amp;gt;setTextCursor(cursor);&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::selectFrame()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    QTextFrame *frame = cursor.currentFrame();&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    cursor.setPosition(frame-&amp;gt;firstPosition());&lt;br /&gt;
    cursor.setPosition(frame-&amp;gt;lastPosition(), QTextCursor::KeepAnchor);&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
    editor-&amp;gt;setTextCursor(cursor);&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::insertList()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    QTextList *list = cursor.currentList();&lt;br /&gt;
    QTextListFormat listFormat;&lt;br /&gt;
    if (list) {&lt;br /&gt;
        listFormat = list-&amp;gt;format();&lt;br /&gt;
        listFormat.setIndent(listFormat.indent() + 1);&lt;br /&gt;
    }&lt;br /&gt;
    listFormat.setStyle(QTextListFormat::ListDisc);&lt;br /&gt;
    cursor.insertList(listFormat);&lt;br /&gt;
&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::updateMenus()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    cutAction-&amp;gt;setEnabled(cursor.hasSelection());&lt;br /&gt;
    copyAction-&amp;gt;setEnabled(cursor.hasSelection());&lt;br /&gt;
    pasteAction-&amp;gt;setEnabled(!selection.isEmpty());&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;mainwindow.h&amp;quot;&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc, argv);&lt;br /&gt;
    MainWindow *window = new MainWindow;&lt;br /&gt;
    window-&amp;gt;resize(640, 480);&lt;br /&gt;
    window-&amp;gt;show();&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using QTextList==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/****************************************************************************&lt;br /&gt;
**&lt;br /&gt;
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;br /&gt;
** All rights reserved.&lt;br /&gt;
** Contact: Nokia Corporation (qt-info@nokia.com)&lt;br /&gt;
**&lt;br /&gt;
** This file is part of the documentation of the Qt Toolkit.&lt;br /&gt;
**&lt;br /&gt;
** $QT_BEGIN_LICENSE:LGPL$&lt;br /&gt;
** Commercial Usage&lt;br /&gt;
** Licensees holding valid Qt Commercial licenses may use this file in&lt;br /&gt;
** accordance with the Qt Commercial License Agreement provided with the&lt;br /&gt;
** Software or, alternatively, in accordance with the terms contained in&lt;br /&gt;
** a written agreement between you and Nokia.&lt;br /&gt;
**&lt;br /&gt;
** GNU Lesser General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU Lesser&lt;br /&gt;
** General Public License version 2.1 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.LGPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU Lesser General Public License version 2.1 requirements&lt;br /&gt;
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.&lt;br /&gt;
**&lt;br /&gt;
** In addition, as a special exception, Nokia gives you certain additional&lt;br /&gt;
** rights.  These rights are described in the Nokia Qt LGPL Exception&lt;br /&gt;
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.&lt;br /&gt;
**&lt;br /&gt;
** GNU General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU&lt;br /&gt;
** General Public License version 3.0 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.GPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU General Public License version 3.0 requirements will be&lt;br /&gt;
** met: http://www.gnu.org/copyleft/gpl.html.&lt;br /&gt;
**&lt;br /&gt;
** If you have questions regarding the use of this file, please contact&lt;br /&gt;
** Nokia at qt-info@nokia.com.&lt;br /&gt;
** $QT_END_LICENSE$&lt;br /&gt;
**&lt;br /&gt;
****************************************************************************/&lt;br /&gt;
#ifndef WINDOW_H&lt;br /&gt;
#define WINDOW_H&lt;br /&gt;
#include &amp;lt;QList&amp;gt;&lt;br /&gt;
#include &amp;lt;QMainWindow&amp;gt;&lt;br /&gt;
#include &amp;lt;QString&amp;gt;&lt;br /&gt;
class QAction;&lt;br /&gt;
class QTextDocument;&lt;br /&gt;
class QTextEdit;&lt;br /&gt;
class QTextList;&lt;br /&gt;
class QTreeWidgetItem;&lt;br /&gt;
class MainWindow : public QMainWindow&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    MainWindow();&lt;br /&gt;
public slots:&lt;br /&gt;
    void insertList();&lt;br /&gt;
    void highlightListItems();&lt;br /&gt;
    void showList();&lt;br /&gt;
private:&lt;br /&gt;
    QString currentFile;&lt;br /&gt;
    QTextEdit *editor;&lt;br /&gt;
    QTextDocument *document;&lt;br /&gt;
    QList&amp;lt;QTextList*&amp;gt; listStructures;&lt;br /&gt;
    QList&amp;lt;QTreeWidgetItem*&amp;gt; previousItems;&lt;br /&gt;
    QList&amp;lt;QTreeWidgetItem*&amp;gt; parentItems;&lt;br /&gt;
};&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;mainwindow.h&amp;quot;&lt;br /&gt;
MainWindow::MainWindow()&lt;br /&gt;
{&lt;br /&gt;
    QMenu *fileMenu = new QMenu(tr(&amp;quot;&amp;amp;File&amp;quot;));&lt;br /&gt;
    fileMenu-&amp;gt;addAction(tr(&amp;quot;E&amp;amp;xit&amp;quot;), this, SLOT(close()),&lt;br /&gt;
        QKeySequence(tr(&amp;quot;Ctrl+Q&amp;quot;, &amp;quot;File|Exit&amp;quot;)));&lt;br /&gt;
    QMenu *actionsMenu = new QMenu(tr(&amp;quot;&amp;amp;Actions&amp;quot;));&lt;br /&gt;
    actionsMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Highlight List Items&amp;quot;),&lt;br /&gt;
                        this, SLOT(highlightListItems()));&lt;br /&gt;
    actionsMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Show Current List&amp;quot;), this, SLOT(showList()));&lt;br /&gt;
    QMenu *insertMenu = new QMenu(tr(&amp;quot;&amp;amp;Insert&amp;quot;));&lt;br /&gt;
    insertMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;List&amp;quot;), this, SLOT(insertList()),&lt;br /&gt;
        QKeySequence(tr(&amp;quot;Ctrl+L&amp;quot;, &amp;quot;Insert|List&amp;quot;)));&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(fileMenu);&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(insertMenu);&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(actionsMenu);&lt;br /&gt;
    editor = new QTextEdit(this);&lt;br /&gt;
    document = new QTextDocument(this);&lt;br /&gt;
    editor-&amp;gt;setDocument(document);&lt;br /&gt;
    setCentralWidget(editor);&lt;br /&gt;
    setWindowTitle(tr(&amp;quot;Text Document List Items&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::highlightListItems()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    QTextList *list = cursor.currentList();&lt;br /&gt;
    if (!list)&lt;br /&gt;
        return;&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    for (int index = 0; index &amp;lt; list-&amp;gt;count(); ++index) {&lt;br /&gt;
        QTextBlock listItem = list-&amp;gt;item(index);&lt;br /&gt;
        QTextBlockFormat newBlockFormat = listItem.blockFormat();&lt;br /&gt;
        newBlockFormat.setBackground(Qt::lightGray);&lt;br /&gt;
        QTextCursor itemCursor = cursor;&lt;br /&gt;
        itemCursor.setPosition(listItem.position());&lt;br /&gt;
        //itemCursor.movePosition(QTextCursor::StartOfBlock);&lt;br /&gt;
        itemCursor.movePosition(QTextCursor::EndOfBlock,&lt;br /&gt;
                                QTextCursor::KeepAnchor);&lt;br /&gt;
        itemCursor.setBlockFormat(newBlockFormat);&lt;br /&gt;
        /*&lt;br /&gt;
        processListItem(listItem);&lt;br /&gt;
        */&lt;br /&gt;
    }&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::showList()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    QTextFrame *frame = cursor.currentFrame();&lt;br /&gt;
    if (!frame)&lt;br /&gt;
        return;&lt;br /&gt;
    QTreeWidget *treeWidget = new QTreeWidget;&lt;br /&gt;
    treeWidget-&amp;gt;setColumnCount(1);&lt;br /&gt;
    QStringList headerLabels;&lt;br /&gt;
    headerLabels &amp;lt;&amp;lt; tr(&amp;quot;Lists&amp;quot;);&lt;br /&gt;
    treeWidget-&amp;gt;setHeaderLabels(headerLabels);&lt;br /&gt;
    QTreeWidgetItem *parentItem = 0;&lt;br /&gt;
    QTreeWidgetItem *item;&lt;br /&gt;
    QTreeWidgetItem *lastItem = 0;&lt;br /&gt;
    parentItems.clear();&lt;br /&gt;
    previousItems.clear();&lt;br /&gt;
&lt;br /&gt;
    QTextFrame::iterator it;&lt;br /&gt;
    for (it = frame-&amp;gt;begin(); !(it.atEnd()); ++it) {&lt;br /&gt;
        QTextBlock block = it.currentBlock();&lt;br /&gt;
        if (block.isValid()) {&lt;br /&gt;
            QTextList *list = block.textList();&lt;br /&gt;
            if (list) {&lt;br /&gt;
                int index = list-&amp;gt;itemNumber(block);&lt;br /&gt;
                if (index == 0) {&lt;br /&gt;
                    parentItems.append(parentItem);&lt;br /&gt;
                    previousItems.append(lastItem);&lt;br /&gt;
                    listStructures.append(list);&lt;br /&gt;
                    parentItem = lastItem;&lt;br /&gt;
                    lastItem = 0;&lt;br /&gt;
                    if (parentItem != 0)&lt;br /&gt;
                        item = new QTreeWidgetItem(parentItem, lastItem);&lt;br /&gt;
                    else&lt;br /&gt;
                        item = new QTreeWidgetItem(treeWidget, lastItem);&lt;br /&gt;
                } else {&lt;br /&gt;
                    while (parentItem != 0 &amp;amp;&amp;amp; listStructures.last() != list) {&lt;br /&gt;
                        listStructures.pop_back();&lt;br /&gt;
                        parentItem = parentItems.takeLast();&lt;br /&gt;
                        lastItem = previousItems.takeLast();&lt;br /&gt;
                    }&lt;br /&gt;
                    if (parentItem != 0)&lt;br /&gt;
                        item = new QTreeWidgetItem(parentItem, lastItem);&lt;br /&gt;
                    else&lt;br /&gt;
                        item = new QTreeWidgetItem(treeWidget, lastItem);&lt;br /&gt;
                }&lt;br /&gt;
                item-&amp;gt;setText(0, block.text());&lt;br /&gt;
                lastItem = item;&lt;br /&gt;
            }&lt;br /&gt;
 &lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    treeWidget-&amp;gt;setWindowTitle(tr(&amp;quot;List Contents&amp;quot;));&lt;br /&gt;
    treeWidget-&amp;gt;show();&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::insertList()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor = editor-&amp;gt;textCursor();&lt;br /&gt;
    cursor.beginEditBlock();&lt;br /&gt;
    QTextList *list = cursor.currentList();&lt;br /&gt;
    QTextListFormat listFormat;&lt;br /&gt;
    if (list)&lt;br /&gt;
        listFormat = list-&amp;gt;format();&lt;br /&gt;
    listFormat.setStyle(QTextListFormat::ListDisc);&lt;br /&gt;
    listFormat.setIndent(listFormat.indent() + 1);&lt;br /&gt;
    cursor.insertList(listFormat);&lt;br /&gt;
    cursor.endEditBlock();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;mainwindow.h&amp;quot;&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc, argv);&lt;br /&gt;
    MainWindow *window = new MainWindow;&lt;br /&gt;
    window-&amp;gt;resize(640, 480);&lt;br /&gt;
    window-&amp;gt;show();&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>