本文整理汇总了C++中QTextOption::setFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextOption::setFlags方法的具体用法?C++ QTextOption::setFlags怎么用?C++ QTextOption::setFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextOption
的用法示例。
在下文中一共展示了QTextOption::setFlags方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPlainTextEdit
TextEditor::TextEditor(QWidget *parent): QPlainTextEdit(parent) {
connect(this, SIGNAL(textChanged()), this, SLOT(UpdateDocumentStatus()));
LineCountArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(UpdateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(UpdateLineNumberArea(QRect,int)));
UpdateLineNumberAreaWidth(0);
// connect(this, SIGNAL(cursorPositionChanged()),
// this, SLOT(Highlight_Current_Line()));
connect(this, SIGNAL(cursorPositionChanged()),
this, SLOT(bracketValidate()));
setFont(QFont("Monaco", 12));
setTabSize(4);
Size = 0;
Counter = 0;
Start = 0;
End = 0;
// Setup autocomplete
minCompleterLength = 1;
c = new QCompleter(this);
// c->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
c->setCompletionMode(QCompleter::PopupCompletion);
c->setCaseSensitivity(Qt::CaseInsensitive);
c->setWrapAround(false);
c->setWidget(this);
c->popup()->setObjectName("autocomplete");
completerModel = new QStringListModel(getWords(), c);
c->setModel(completerModel);
connect(this, SIGNAL(textChanged()),
this, SLOT(updateCompleterModel()));
QTextOption option = document()->defaultTextOption();
bool on = false;
if (on) {
option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
} else {
option.setFlags(option.flags() & ~QTextOption::ShowTabsAndSpaces);
}
option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
document()->setDefaultTextOption(option);
setTabsAsSpaces(true);
bracketMismatchFormat = currentCharFormat();
bracketMismatchFormat.setBackground(QColor(255, 223, 223));
bracketMatchFormat = currentCharFormat();
bracketMatchFormat.setBackground(QColor(158, 209, 255));
}
示例2: setVisualizeWhitespace
void FormatTextEdit::setVisualizeWhitespace(bool value)
{
QTextOption option = document()->defaultTextOption();
if (value) {
option.setFlags(option.flags()
| QTextOption::ShowLineAndParagraphSeparators
| QTextOption::ShowTabsAndSpaces);
} else {
option.setFlags(option.flags()
& ~QTextOption::ShowLineAndParagraphSeparators
& ~QTextOption::ShowTabsAndSpaces);
}
document()->setDefaultTextOption(option);
}
示例3: ExpandingTextEdit
FormatTextEdit::FormatTextEdit(QWidget *parent)
: ExpandingTextEdit(parent)
{
setLineWrapMode(QTextEdit::WidgetWidth);
setAcceptRichText(false);
QTextOption option = document()->defaultTextOption();
option.setFlags(option.flags()
| QTextOption::ShowLineAndParagraphSeparators
| QTextOption::ShowTabsAndSpaces);
document()->setDefaultTextOption(option);
// Do not set different background if disabled
QPalette p = palette();
p.setColor(QPalette::Disabled, QPalette::Base, p.color(QPalette::Active, QPalette::Base));
setPalette(p);
setEditable(true);
m_highlighter = new MessageHighlighter(this);
}
示例4: d
TextDocument::TextDocument(Id id)
: d(new TextDocumentPrivate)
{
connect(&d->m_document, &QTextDocument::modificationChanged,
this, &TextDocument::modificationChanged);
connect(&d->m_document, &QTextDocument::contentsChanged,
this, &Core::IDocument::contentsChanged);
connect(&d->m_document, &QTextDocument::contentsChange,
this, &TextDocument::contentsChangedWithPosition);
// set new document layout
QTextOption opt = d->m_document.defaultTextOption();
opt.setTextDirection(Qt::LeftToRight);
opt.setFlags(opt.flags() | QTextOption::IncludeTrailingSpaces
| QTextOption::AddSpaceForLineAndParagraphSeparators
);
d->m_document.setDefaultTextOption(opt);
d->m_document.setDocumentLayout(new TextDocumentLayout(&d->m_document));
if (id.isValid())
setId(id);
setSuspendAllowed(true);
}
示例5: sipReleaseType
static PyObject *meth_QTextOption_setFlags(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QTextOption::Flags* a0;
int a0State = 0;
QTextOption *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QTextOption, &sipCpp, sipType_QTextOption_Flags, &a0, &a0State))
{
sipCpp->setFlags(*a0);
sipReleaseType(a0,sipType_QTextOption_Flags,a0State);
Py_INCREF(Py_None);
return Py_None;
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QTextOption, sipName_setFlags, doc_QTextOption_setFlags);
return NULL;
}