Doc: compile scribe-overview snippet
Done-with: Nico Vertriest <nico.vertriest@qt.io> Task-number: QTBUG-81486 Change-Id: If760744aba49361d8d9ed51c4a2641b743c35c25 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>bb10
parent
ad654870cb
commit
7e571c3927
|
|
@ -47,37 +47,37 @@
|
|||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QApplication>
|
||||
#include <QTextEdit>
|
||||
|
||||
void mergeFormat(QTextEdit *edit)
|
||||
{
|
||||
//! [0]
|
||||
QTextDocument *document = edit->document();
|
||||
QTextCursor cursor(document);
|
||||
QTextDocument *document = edit->document();
|
||||
QTextCursor cursor(document);
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||
|
||||
QTextCharFormat format;
|
||||
format.setFontWeight(QFont::Bold);
|
||||
QTextCharFormat format;
|
||||
format.setFontWeight(QFont::Bold);
|
||||
|
||||
cursor.mergeCharFormat(format);
|
||||
cursor.mergeCharFormat(format);
|
||||
//! [0]
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QWidget *parent = nullptr;
|
||||
QString aStringContainingHTMLtext("<h1>Scribe Overview</h1>");
|
||||
QWidget *parent = nullptr;
|
||||
QString aStringContainingHTMLtext("<h1>Scribe Overview</h1>");
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
//! [1]
|
||||
QTextEdit *editor = new QTextEdit(parent);
|
||||
editor->setHtml(aStringContainingHTMLtext);
|
||||
editor->show();
|
||||
QTextEdit *editor = new QTextEdit(parent);
|
||||
editor->setHtml(aStringContainingHTMLtext);
|
||||
editor->show();
|
||||
//! [1]
|
||||
|
||||
return app.exec();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,6 @@
|
|||
SOURCES = main.cpp
|
||||
TEMPLATE = lib
|
||||
TARGET = scribe-overview_snippets
|
||||
QT += core gui widgets
|
||||
|
||||
SOURCES = \
|
||||
main.cpp
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ contains(QT_BUILD_PARTS, tests) {
|
|||
qimagewriter \
|
||||
qstatustipevent \
|
||||
qtextobject \
|
||||
scribe-overview \
|
||||
textblock-formats \
|
||||
textblock-fragments \
|
||||
textdocument-blocks \
|
||||
|
|
|
|||
Loading…
Reference in New Issue