11 QMenu *fileMenu =
new QMenu(tr(
"&File"));
13 fileMenu->addAction(tr(
"E&xit"), QKeySequence(tr(
"Ctrl+Q",
"File|Exit")),
16 QMenu *insertMenu =
new QMenu(tr(
"&Insert"));
18 insertMenu->addAction(tr(
"&List"), QKeySequence(tr(
"Ctrl+L",
"Insert|List")),
19 this, SLOT(insertList()));
21 menuBar()->addMenu(fileMenu);
22 menuBar()->addMenu(insertMenu);
24 editor =
new QTextEdit(
this);
25 document =
new QTextDocument(
this);
26 editor->setDocument(document);
28 setCentralWidget(editor);
29 setWindowTitle(tr(
"Text Document List Item Styles"));
34 QTextCursor cursor = editor->textCursor();
35 cursor.beginEditBlock();
38 QTextListFormat listFormat;
40 listFormat.setStyle(QTextListFormat::ListDecimal);
41 listFormat.setNumberPrefix(
"(");
42 listFormat.setNumberSuffix(
")");
44 cursor.insertList(listFormat);
47 cursor.endEditBlock();