本文整理汇总了C++中QPlainTextEdit::currentCharFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlainTextEdit::currentCharFormat方法的具体用法?C++ QPlainTextEdit::currentCharFormat怎么用?C++ QPlainTextEdit::currentCharFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPlainTextEdit
的用法示例。
在下文中一共展示了QPlainTextEdit::currentCharFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testQtOutputFormatter_appendMixedAssertAndAnsi
void QtSupportPlugin::testQtOutputFormatter_appendMixedAssertAndAnsi()
{
QPlainTextEdit edit;
TestQtOutputFormatter formatter;
formatter.setPlainTextEdit(&edit);
const QString inputText = QString::fromLatin1(
"\x1b[38;2;0;0;127mHello\n"
"Object::Test in test.cpp:123\n"
"\x1b[38;2;0;0;127mHello\n");
const QString outputText = QString::fromLatin1(
"Hello\n"
"Object::Test in test.cpp:123\n"
"Hello\n");
formatter.appendMessage(inputText, QTextCharFormat());
QCOMPARE(edit.toPlainText(), outputText);
edit.moveCursor(QTextCursor::Start);
QCOMPARE(edit.currentCharFormat(), blueFormat());
edit.moveCursor(QTextCursor::Down);
edit.moveCursor(QTextCursor::EndOfLine);
QCOMPARE(edit.currentCharFormat(), linkFormat(QTextCharFormat(), QLatin1String("test.cpp:123")));
edit.moveCursor(QTextCursor::End);
QCOMPARE(edit.currentCharFormat(), blueFormat());
}
示例2: testQtOutputFormatter_appendMessage
void QtSupportPlugin::testQtOutputFormatter_appendMessage()
{
QPlainTextEdit edit;
TestQtOutputFormatter formatter;
formatter.setPlainTextEdit(&edit);
QFETCH(QString, inputText);
QFETCH(QString, outputText);
QFETCH(QTextCharFormat, inputFormat);
QFETCH(QTextCharFormat, outputFormat);
formatter.appendMessage(inputText, inputFormat);
QCOMPARE(edit.toPlainText(), outputText);
QCOMPARE(edit.currentCharFormat(), outputFormat);
}