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%2FQTextBlockFormat</id>
		<title>C++/Qt/QTextBlockFormat - История изменений</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%2FQTextBlockFormat"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextBlockFormat&amp;action=history"/>
		<updated>2026-04-18T17:02:11Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QTextBlockFormat&amp;diff=970&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/QTextBlockFormat&amp;diff=970&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/QTextBlockFormat&amp;diff=971&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/QTextBlockFormat&amp;diff=971&amp;oldid=prev"/>
				<updated>2010-05-25T10:24:23Z</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;==Text block format==&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;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
QString tr(const char *text)&lt;br /&gt;
{&lt;br /&gt;
    return QApplication::translate(text, text);&lt;br /&gt;
}&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc, argv);&lt;br /&gt;
&lt;br /&gt;
    QTextEdit *editor = new QTextEdit();&lt;br /&gt;
    QTextCursor cursor(editor-&amp;gt;textCursor());&lt;br /&gt;
    cursor.movePosition(QTextCursor::Start); &lt;br /&gt;
    QTextBlockFormat blockFormat = cursor.blockFormat();&lt;br /&gt;
    blockFormat.setTopMargin(4);&lt;br /&gt;
    blockFormat.setLeftMargin(4);&lt;br /&gt;
    blockFormat.setRightMargin(4);&lt;br /&gt;
    blockFormat.setBottomMargin(4);&lt;br /&gt;
    cursor.setBlockFormat(blockFormat);&lt;br /&gt;
    cursor.insertText(tr(&amp;quot;This contains plain text inside a &amp;quot;&lt;br /&gt;
                         &amp;quot;text block with margins to keep it separate &amp;quot;&lt;br /&gt;
                         &amp;quot;from other parts of the document.&amp;quot;));&lt;br /&gt;
    cursor.insertBlock();&lt;br /&gt;
&lt;br /&gt;
    QTextBlockFormat backgroundFormat = blockFormat;&lt;br /&gt;
    backgroundFormat.setBackground(QColor(&amp;quot;lightGray&amp;quot;));&lt;br /&gt;
    cursor.setBlockFormat(backgroundFormat);&lt;br /&gt;
    cursor.insertText(tr(&amp;quot;The background color of a text block can be &amp;quot;&lt;br /&gt;
                         &amp;quot;changed to highlight text.&amp;quot;));&lt;br /&gt;
    cursor.insertBlock();&lt;br /&gt;
    QTextBlockFormat rightAlignedFormat = blockFormat;&lt;br /&gt;
    rightAlignedFormat.setAlignment(Qt::AlignRight);&lt;br /&gt;
    cursor.setBlockFormat(rightAlignedFormat);&lt;br /&gt;
    cursor.insertText(tr(&amp;quot;The alignment of the text within a block is &amp;quot;&lt;br /&gt;
                         &amp;quot;controlled by the alignment properties of &amp;quot;&lt;br /&gt;
                         &amp;quot;the block itself. This text block is &amp;quot;&lt;br /&gt;
                         &amp;quot;right-aligned.&amp;quot;));&lt;br /&gt;
    cursor.insertBlock();&lt;br /&gt;
    QTextBlockFormat paragraphFormat = blockFormat;&lt;br /&gt;
    paragraphFormat.setAlignment(Qt::AlignJustify);&lt;br /&gt;
    paragraphFormat.setTextIndent(32);&lt;br /&gt;
    cursor.setBlockFormat(paragraphFormat);&lt;br /&gt;
    cursor.insertText(tr(&amp;quot;Text can be formatted so that the first &amp;quot;&lt;br /&gt;
                         &amp;quot;line in a paragraph has its own margin. &amp;quot;&lt;br /&gt;
                         &amp;quot;This makes the text more readable.&amp;quot;));&lt;br /&gt;
    cursor.insertBlock();&lt;br /&gt;
    QTextBlockFormat reverseFormat = blockFormat;&lt;br /&gt;
    reverseFormat.setAlignment(Qt::AlignJustify);&lt;br /&gt;
    reverseFormat.setTextIndent(32);&lt;br /&gt;
    cursor.setBlockFormat(reverseFormat);&lt;br /&gt;
    cursor.insertText(tr(&amp;quot;The direction of the text can be reversed. &amp;quot;&lt;br /&gt;
                         &amp;quot;This is useful for right-to-left &amp;quot;&lt;br /&gt;
                         &amp;quot;languages.&amp;quot;));&lt;br /&gt;
    editor-&amp;gt;setWindowTitle(tr(&amp;quot;Text Block Formats&amp;quot;));&lt;br /&gt;
    editor-&amp;gt;resize(480, 480);&lt;br /&gt;
    editor-&amp;gt;show();&lt;br /&gt;
    &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;
==Text block fragments==&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 XMLWRITER_H&lt;br /&gt;
#define XMLWRITER_H&lt;br /&gt;
#include &amp;lt;QDomDocument&amp;gt;&lt;br /&gt;
class QTextDocument;&lt;br /&gt;
class XmlWriter&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
    XmlWriter(QTextDocument *document) : textDocument(document) {}&lt;br /&gt;
    QDomDocument *toXml();&lt;br /&gt;
private:&lt;br /&gt;
    void readFragment(const QTextBlock &amp;amp;currentBlock, QDomElement blockElement,&lt;br /&gt;
                      QDomDocument *document);&lt;br /&gt;
    void processBlock(const QTextBlock &amp;amp;currentBlock);&lt;br /&gt;
    void processFragment(const QTextFragment &amp;amp;currentFragment);&lt;br /&gt;
    QDomDocument *document;&lt;br /&gt;
    QTextDocument *textDocument;&lt;br /&gt;
};&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;xmlwriter.h&amp;quot;&lt;br /&gt;
QDomDocument *XmlWriter::toXml()&lt;br /&gt;
{&lt;br /&gt;
    QDomImplementation implementation;&lt;br /&gt;
    QDomDocumentType docType = implementation.createDocumentType(&lt;br /&gt;
        &amp;quot;scribe-document&amp;quot;, &amp;quot;scribe&amp;quot;, &amp;quot;qt.nokia.com/scribe&amp;quot;);&lt;br /&gt;
    document = new QDomDocument(docType);&lt;br /&gt;
    // ### This processing instruction is required to ensure that any kind&lt;br /&gt;
    // of encoding is given when the document is written.&lt;br /&gt;
    QDomProcessingInstruction process = document-&amp;gt;createProcessingInstruction(&lt;br /&gt;
        &amp;quot;xml&amp;quot;, &amp;quot;version=\&amp;quot;1.0\&amp;quot; encoding=\&amp;quot;utf-8\&amp;quot;&amp;quot;);&lt;br /&gt;
    document-&amp;gt;appendChild(process);&lt;br /&gt;
    QDomElement documentElement = document-&amp;gt;createElement(&amp;quot;document&amp;quot;);&lt;br /&gt;
    document-&amp;gt;appendChild(documentElement);&lt;br /&gt;
&lt;br /&gt;
    QTextBlock currentBlock = textDocument-&amp;gt;begin();&lt;br /&gt;
    while (currentBlock.isValid()) {&lt;br /&gt;
        QDomElement blockElement = document-&amp;gt;createElement(&amp;quot;block&amp;quot;);&lt;br /&gt;
        document-&amp;gt;appendChild(blockElement);&lt;br /&gt;
        readFragment(currentBlock, blockElement, document);&lt;br /&gt;
&lt;br /&gt;
        processBlock(currentBlock);&lt;br /&gt;
&lt;br /&gt;
        currentBlock = currentBlock.next();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return document;&lt;br /&gt;
}&lt;br /&gt;
void XmlWriter::readFragment(const QTextBlock &amp;amp;currentBlock,&lt;br /&gt;
                             QDomElement blockElement,&lt;br /&gt;
                             QDomDocument *document)&lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
    QTextBlock::iterator it;&lt;br /&gt;
    for (it = currentBlock.begin(); !(it.atEnd()); ++it) {&lt;br /&gt;
        QTextFragment currentFragment = it.fragment();&lt;br /&gt;
        if (currentFragment.isValid())&lt;br /&gt;
 &lt;br /&gt;
            processFragment(currentFragment);&lt;br /&gt;
 &lt;br /&gt;
        if (currentFragment.isValid()) {&lt;br /&gt;
            QDomElement fragmentElement = document-&amp;gt;createElement(&amp;quot;fragment&amp;quot;);&lt;br /&gt;
            blockElement.appendChild(fragmentElement);&lt;br /&gt;
            fragmentElement.setAttribute(&amp;quot;length&amp;quot;, currentFragment.length());&lt;br /&gt;
            QDomText fragmentText = document-&amp;gt;createTextNode(currentFragment.text());&lt;br /&gt;
            fragmentElement.appendChild(fragmentText);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
void XmlWriter::processBlock(const QTextBlock &amp;amp;currentBlock)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
void XmlWriter::processFragment(const QTextFragment &amp;amp;currentFragment)&lt;br /&gt;
{&lt;br /&gt;
}&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;
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 insertCalendar();&lt;br /&gt;
    void saveFile();&lt;br /&gt;
private:&lt;br /&gt;
    bool writeXml(const QString &amp;amp;fileName);&lt;br /&gt;
    QTextEdit *editor;&lt;br /&gt;
};&lt;br /&gt;
#endif&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;
#include &amp;quot;xmlwriter.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;
    QAction *saveAction = fileMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Save...&amp;quot;));&lt;br /&gt;
    saveAction-&amp;gt;setShortcut(tr(&amp;quot;Ctrl+S&amp;quot;));&lt;br /&gt;
    QAction *quitAction = fileMenu-&amp;gt;addAction(tr(&amp;quot;E&amp;amp;xit&amp;quot;));&lt;br /&gt;
    quitAction-&amp;gt;setShortcut(tr(&amp;quot;Ctrl+Q&amp;quot;));&lt;br /&gt;
    QMenu *insertMenu = new QMenu(tr(&amp;quot;&amp;amp;Insert&amp;quot;));&lt;br /&gt;
    QAction *calendarAction = insertMenu-&amp;gt;addAction(tr(&amp;quot;&amp;amp;Calendar&amp;quot;));&lt;br /&gt;
    calendarAction-&amp;gt;setShortcut(tr(&amp;quot;Ctrl+I&amp;quot;));&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(fileMenu);&lt;br /&gt;
    menuBar()-&amp;gt;addMenu(insertMenu);&lt;br /&gt;
    editor = new QTextEdit(this);&lt;br /&gt;
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));&lt;br /&gt;
    connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));&lt;br /&gt;
    connect(calendarAction, SIGNAL(triggered()), this, SLOT(insertCalendar()));&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::saveFile()&lt;br /&gt;
{&lt;br /&gt;
    QString fileName = QFileDialog::getSaveFileName(this,&lt;br /&gt;
        tr(&amp;quot;Save document as:&amp;quot;), &amp;quot;&amp;quot;, tr(&amp;quot;XML (*.xml)&amp;quot;));&lt;br /&gt;
    if (!fileName.isEmpty()) {&lt;br /&gt;
        if (writeXml(fileName))&lt;br /&gt;
            setWindowTitle(fileName);&lt;br /&gt;
        else&lt;br /&gt;
            QMessageBox::warning(this, tr(&amp;quot;Warning&amp;quot;),&lt;br /&gt;
                tr(&amp;quot;Failed to save the document.&amp;quot;), QMessageBox::Cancel,&lt;br /&gt;
                QMessageBox::NoButton);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
void MainWindow::insertCalendar()&lt;br /&gt;
{&lt;br /&gt;
    QTextCursor cursor(editor-&amp;gt;textCursor());&lt;br /&gt;
    cursor.movePosition(QTextCursor::Start); &lt;br /&gt;
    QTextCharFormat format(cursor.charFormat());&lt;br /&gt;
    format.setFontFamily(&amp;quot;Courier&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    QTextCharFormat boldFormat = format;&lt;br /&gt;
    boldFormat.setFontWeight(QFont::Bold);&lt;br /&gt;
    cursor.insertBlock();&lt;br /&gt;
    cursor.insertText(&amp;quot; &amp;quot;, boldFormat);&lt;br /&gt;
    QDate date = QDate::currentDate();&lt;br /&gt;
    int year = date.year(), month = date.month();&lt;br /&gt;
    for (int weekDay = 1; weekDay &amp;lt;= 7; ++weekDay) {&lt;br /&gt;
        cursor.insertText(QString(&amp;quot;%1 &amp;quot;).arg(QDate::shortDayName(weekDay), 3),&lt;br /&gt;
            boldFormat);&lt;br /&gt;
    }&lt;br /&gt;
    cursor.insertBlock();&lt;br /&gt;
    cursor.insertText(&amp;quot; &amp;quot;, format);&lt;br /&gt;
    for (int column = 1; column &amp;lt; QDate(year, month, 1).dayOfWeek(); ++column) {&lt;br /&gt;
        cursor.insertText(&amp;quot;    &amp;quot;, format);&lt;br /&gt;
    }&lt;br /&gt;
    for (int day = 1; day &amp;lt;= date.daysInMonth(); ++day) {&lt;br /&gt;
        int weekDay = QDate(year, month, day).dayOfWeek();&lt;br /&gt;
        if (QDate(year, month, day) == date)&lt;br /&gt;
            cursor.insertText(QString(&amp;quot;%1 &amp;quot;).arg(day, 3), boldFormat);&lt;br /&gt;
        else&lt;br /&gt;
            cursor.insertText(QString(&amp;quot;%1 &amp;quot;).arg(day, 3), format);&lt;br /&gt;
        if (weekDay == 7) {&lt;br /&gt;
            cursor.insertBlock();&lt;br /&gt;
            cursor.insertText(&amp;quot; &amp;quot;, format);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
bool MainWindow::writeXml(const QString &amp;amp;fileName)&lt;br /&gt;
{&lt;br /&gt;
    XmlWriter documentWriter(editor-&amp;gt;document());&lt;br /&gt;
    QDomDocument *domDocument = documentWriter.toXml();&lt;br /&gt;
    QFile file(fileName);&lt;br /&gt;
    if (file.open(QFile::WriteOnly)) {&lt;br /&gt;
        QTextStream textStream(&amp;amp;file);&lt;br /&gt;
        &lt;br /&gt;
        textStream &amp;lt;&amp;lt; domDocument-&amp;gt;toByteArray(1);&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
        return false;&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>