本文整理汇总了C++中QTextFrameFormat::setForeground方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextFrameFormat::setForeground方法的具体用法?C++ QTextFrameFormat::setForeground怎么用?C++ QTextFrameFormat::setForeground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextFrameFormat
的用法示例。
在下文中一共展示了QTextFrameFormat::setForeground方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fm
ClientTextEdit::ClientTextEdit(QWidget* parent) : QTextEdit(parent) {
setReadOnly(true);
setOverwriteMode(true);
setUndoRedoEnabled(false);
setDocumentTitle("mClient");
setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
setTabChangesFocus(false);
//_doc->setMaximumBlockCount(Config().scrollbackSize); // max number of lines?
document()->setUndoRedoEnabled(false);
QTextFrame* frame = document()->rootFrame();
_cursor = frame->firstCursorPosition();
// Default Colors
_foregroundColor = Qt::lightGray;
_backgroundColor = Qt::black;
_blackColor = Qt::darkGray;
_redColor = Qt::darkRed;
_greenColor = Qt::darkGreen;
_yellowColor = Qt::darkYellow;
_blueColor = Qt::darkBlue;
_magentaColor = Qt::darkMagenta;
_cyanColor = Qt::darkCyan;
_grayColor = Qt::lightGray;
_darkGrayColor = Qt::gray;
_brightRedColor = Qt::red;
_brightGreenColor = Qt::green;
_brightYellowColor = Qt::yellow;
_brightBlueColor = Qt::blue;
_brightMagentaColor = Qt::magenta;
_brightCyanColor = Qt::cyan;
_whiteColor = Qt::white;
// Default Fonts
_serverOutputFont = QFont("Monospace", 10);
_inputLineFont = QFont("Monospace", 10); //QApplication::font();
_serverOutputFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
QTextFrameFormat frameFormat = frame->frameFormat();
frameFormat.setBackground(_backgroundColor);
frameFormat.setForeground(_foregroundColor);
frame->setFrameFormat(frameFormat);
_format = _cursor.charFormat();
setDefaultFormat(_format);
_defaultFormat = _format;
_cursor.setCharFormat(_format);
QFontMetrics fm(_serverOutputFont);
setTabStopWidth(fm.width(" ") * 8); // A tab is 8 spaces wide
QScrollBar* scrollbar = verticalScrollBar();
scrollbar->setSingleStep(fm.leading()+fm.height());
connect(scrollbar, SIGNAL(sliderReleased()),
this, SLOT(scrollBarReleased()));
previous = 0;
}