diff options
| author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-27 08:54:55 (GMT) |
|---|---|---|
| committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-27 08:54:55 (GMT) |
| commit | 272a3cb81273dd8d3f7cd139df65b11ed02314c6 (patch) | |
| tree | e7d472a44f7b1c95961f8f31d792e8a04cf66c34 /doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp | |
| parent | fd7ba9728a9a580fc446b71134d4c0647c235b4f (diff) | |
| parent | 9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267 (diff) | |
| download | Qt-272a3cb81273dd8d3f7cd139df65b11ed02314c6.zip Qt-272a3cb81273dd8d3f7cd139df65b11ed02314c6.tar.gz Qt-272a3cb81273dd8d3f7cd139df65b11ed02314c6.tar.bz2 | |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-releng-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-releng-team: (182 commits)
qsystemlibrary needs no special treatment
my changelog for 4.8.0
Use numeric virtual keyboard for all number entry modes.
Add a function that returns the D-Bus local machine ID
QTBUG-17776, reporting terminated threads as not running on Symbian
Splitview - Auto-translation rules changed
Support clipboard function on Symbian
Added qmlshadersplugin to Symbian qt.iby-file.
Add an SSE4.2 even simpler version of toLatin1
Skip boundry neutral characters in bidi itemization
Workaround webkit deadlock on macos x
symbian socket engine: resolve some fixme and todo items
trivial: fix typo in comment
Fix QDeclarativeInspector when starting with ,block
changelog
docu update for QNX 6.5
get rid of anacronysm
massive improvements for the QNX screen driver
massive improvements for the QNX mouse driver
massive improvements for the QNX keyboard driver
...
Diffstat (limited to 'doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp')
| -rw-r--r-- | doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp new file mode 100644 index 0000000..94e98b3 --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" + +MainWindow::MainWindow() +{ + QMenu *fileMenu = new QMenu(tr("&File")); + + fileMenu->addAction(tr("E&xit"), this, SLOT(close()), + QKeySequence(tr("Ctrl+Q", "File|Exit"))); + + QMenu *insertMenu = new QMenu(tr("&Insert")); + + insertMenu->addAction(tr("&List"), this, SLOT(insertList()), + QKeySequence(tr("Ctrl+L", "Insert|List"))); + + menuBar()->addMenu(fileMenu); + menuBar()->addMenu(insertMenu); + + editor = new QTextEdit(this); + document = new QTextDocument(this); + editor->setDocument(document); + + setCentralWidget(editor); + setWindowTitle(tr("Text Document List Item Styles")); +} + +void MainWindow::insertList() +{ + QTextCursor cursor = editor->textCursor(); + cursor.beginEditBlock(); + + //! [add a styled, ordered list] + QTextListFormat listFormat; + + listFormat.setStyle(QTextListFormat::ListDecimal); + listFormat.setNumberPrefix("("); + listFormat.setNumberSuffix(")"); + + cursor.insertList(listFormat); + //! [add a styled, ordered list] + + cursor.endEditBlock(); +} |
