当前位置: 首页>>代码示例>>C++>>正文


C++ QTextEdit::textColor方法代码示例

本文整理汇总了C++中QTextEdit::textColor方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::textColor方法的具体用法?C++ QTextEdit::textColor怎么用?C++ QTextEdit::textColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTextEdit的用法示例。


在下文中一共展示了QTextEdit::textColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: textColor

int TextEdit::textColor(lua_State * L) // const : QColor
{
	QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
	QColor* res = ValueInstaller2<QColor>::create( L );
	*res = 	obj->textColor();
	return 1;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:7,代码来源:QtlTextEdit.cpp

示例2: textColor

QColor QTextEditProto::textColor() const
{
  QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
  if (item)
    return item->textColor();
  return QColor();
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:7,代码来源:qtexteditproto.cpp

示例3: on_actionChangeFontColor_triggered

void MainWindow::on_actionChangeFontColor_triggered()
{
    QTextEdit *pEdit = textEditor.editor;
    QColor col = QColorDialog::getColor(pEdit->textColor(), this);
    if (!col.isValid())
        return;
    QTextCharFormat fmt;
    fmt.setForeground(col);
    mergeFormatOnWordOrSelection(fmt);
    colorChanged(col);
}
开发者ID:KanagiMiss,项目名称:testassist,代码行数:11,代码来源:mainwindow.cpp

示例4: eventFilter

bool EmulApp::eventFilter(QObject *watched, QEvent *event)
{
    int type = static_cast<int>(event->type());
    if (type == QEvent::KeyPress) {
    } 
    MainWindow *mw = dynamic_cast<MainWindow *>(watched);
    if (mw) {
        if (type == LogLineEventType) {
            LogLineEvent *evt = dynamic_cast<LogLineEvent *>(event);
            if (evt && mw->textEdit()) {
                QTextEdit *te = mw->textEdit();
                QColor origcolor = te->textColor();
                te->setTextColor(evt->color);
                te->append(evt->str);

                // make sure the log textedit doesn't grow forever
                // so prune old lines when a threshold is hit
                nLinesInLog += evt->str.split("\n").size();
                if (nLinesInLog > nLinesInLogMax) {
                    const int n2del = MAX(nLinesInLogMax/10, nLinesInLog-nLinesInLogMax);
                    QTextCursor cursor = te->textCursor();
                    cursor.movePosition(QTextCursor::Start);
                    for (int i = 0; i < n2del; ++i) {
                        cursor.movePosition(QTextCursor::Down, QTextCursor::KeepAnchor);
                    }
                    cursor.removeSelectedText(); // deletes the lines, leaves a blank line
                    nLinesInLog -= n2del;
                }

                te->setTextColor(origcolor);
                te->moveCursor(QTextCursor::End);
                te->ensureCursorVisible();
                return true;
            } else {
                return false;
            }
        } else if (type == StatusMsgEventType) {
            StatusMsgEvent *evt = dynamic_cast<StatusMsgEvent *>(event);
            if (evt && mw->statusBar()) {
                mw->statusBar()->showMessage(evt->msg, evt->timeout);
                return true;
            } else {
                return false;
            }
        }
    }
    if (watched == this) {
        if (type == QuitEventType) {
            quit();
            return true;
        }
        if (type == SoundTrigEventType) {
            SoundTrigEvent *evt = dynamic_cast<SoundTrigEvent *>(event);
            if (evt) trigSound(evt->trig);
            if (evt->listener) evt->listener->triggered(evt->trig);
            return true;
        }
        if (type == SoundEventType) {
            SoundEvent *evt = dynamic_cast<SoundEvent *>(event);
            if (evt) gotSound(evt->id, evt->name, evt->loops);
            if (evt->listener) evt->listener->gotSound(evt->id);
            return true;
        }
    }
    // otherwise do default action for event which probably means
    // propagate it down
    return QApplication::eventFilter(watched, event);
}
开发者ID:jerlich,项目名称:rt-fsm,代码行数:68,代码来源:EmulApp.cpp


注:本文中的QTextEdit::textColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。