summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/textdocument-end/textdocumentendsnippet.cpp
blob: 1653fd4d2f781a94087da0191c1789747659531b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QtGui>
#include <iostream>

namespace textdocumentendsnippet {
void wrapper()
{
    QString contentString("One\nTwp\nThree");
    QTextDocument *doc = new QTextDocument(contentString);

//! [0]
for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
    std::cout << it.text().toStdString() << "\n";
//! [0]

} // wrapper
} //textdocumentendsnippet