diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-20 23:31:19 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-20 23:31:19 (GMT) |
commit | 1ba1c20a38442d91bcba2761d6d90d6077b7b361 (patch) | |
tree | a14327b336f9be73dcfbefc715e119687164e93d /doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp | |
parent | 28cb38886d9b51e374fec71f9a2c5da6ee437e1f (diff) | |
parent | 6a0d575270581e353af2a214451f6b41dd601f6e (diff) | |
download | Qt-1ba1c20a38442d91bcba2761d6d90d6077b7b361.zip Qt-1ba1c20a38442d91bcba2761d6d90d6077b7b361.tar.gz Qt-1ba1c20a38442d91bcba2761d6d90d6077b7b361.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-doc-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-doc-staging: (82 commits)
Doc: Fixed spelling errors that were blocking the CI system.
Added missing license headers.
Added missing license headers.
Doc: Added missing license headers for documentation and examples.
qdoc: Fixed code to match comments in QML files. Fixed API types.
Doc: Speculative attempt to fix build breakage.
Doc: Fixed file name of a header file to use lower case characters.
Doc: Speculative attempt to fix build breakage.
Doc: Fixed file name of a header file to use lower case characters.
Doc: Fixed links.
Doc: Added a snippet to show how to test the Qt version.
Added an additional check to workaround an issue on Windows.
Doc: Fixed a scope test for maemo5 and made an error a warning instead.
converted to unix txt file
try to resolve CRLR problems
"TAB character in non-leading whitespace" fixed
* fixed trailing- and whitespaces
* "How To Learn Qt" is almost complete. Last section is missing * Several external and internal (Qt) web links added
Undo accidental breakage.
Doc: Added some more information about visited links in rich text.
...
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(); +} |