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


C++ QPlainTextEdit::setUndoRedoEnabled方法代码示例

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


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

示例1: ColorEditor

QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
    const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
{
    QVariant variant = index.data();
    if (!variant.isValid())
    {
        variant = index.data(Qt::DisplayRole);
        if (!variant.isValid())
        {
            return 0;
        }
    }

    // NOTE: for each editor type (e.g. QLineEdit) there needs to be a corresponding
    // entry in CSVWorld::DialogueDelegateDispatcher::makeEditor()
    switch (display)
    {
        case CSMWorld::ColumnBase::Display_Colour:

            return new CSVWidget::ColorEditor(index.data().value<QColor>(), parent);

        case CSMWorld::ColumnBase::Display_Integer:
        {
            DialogueSpinBox *sb = new DialogueSpinBox(parent);
            sb->setRange(INT_MIN, INT_MAX);
            return sb;
        }

        case CSMWorld::ColumnBase::Display_Var:

            return new QLineEdit(parent);

        case CSMWorld::ColumnBase::Display_Float:
        {
            DialogueDoubleSpinBox *dsb = new DialogueDoubleSpinBox(parent);
            dsb->setRange(-FLT_MAX, FLT_MAX);
            dsb->setSingleStep(0.01f);
            dsb->setDecimals(3);
            return dsb;
        }

        case CSMWorld::ColumnBase::Display_LongString:
        {
            QPlainTextEdit *edit = new QPlainTextEdit(parent);
            edit->setUndoRedoEnabled (false);
            return edit;
        }

        case CSMWorld::ColumnBase::Display_LongString256:
        {
            /// \todo implement size limit. QPlainTextEdit does not support a size limit.
            QPlainTextEdit *edit = new QPlainTextEdit(parent);
            edit->setUndoRedoEnabled (false);
            return edit;
        }

        case CSMWorld::ColumnBase::Display_Boolean:

            return new QCheckBox(parent);

        case CSMWorld::ColumnBase::Display_ScriptLines:

            return new ScriptEdit (mDocument, ScriptHighlighter::Mode_Console, parent);

        case CSMWorld::ColumnBase::Display_String:
        // For other Display types (that represent record IDs) with drop support IdCompletionDelegate is used

            return new CSVWidget::DropLineEdit(display, parent);

        case CSMWorld::ColumnBase::Display_String32:
        {
        // For other Display types (that represent record IDs) with drop support IdCompletionDelegate is used
            CSVWidget::DropLineEdit *widget = new CSVWidget::DropLineEdit(display, parent);
            widget->setMaxLength (32);
            return widget;
        }

        default:

            return QStyledItemDelegate::createEditor (parent, option, index);
    }
}
开发者ID:ChairGraveyard,项目名称:TES3MP,代码行数:82,代码来源:util.cpp

示例2: QLineEdit

QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
    const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
{
    QVariant variant = index.data();
    if (!variant.isValid())
    {
        variant = index.data(Qt::DisplayRole);
        if (!variant.isValid())
        {
            return 0;
        }
    }

    // NOTE: for each editor type (e.g. QLineEdit) there needs to be a corresponding
    // entry in CSVWorld::DialogueDelegateDispatcher::makeEditor()
    switch (display)
    {
        case CSMWorld::ColumnBase::Display_Colour:

            return new QLineEdit(parent);

        case CSMWorld::ColumnBase::Display_Integer:
        {
            QSpinBox *sb = new QSpinBox(parent);
            sb->setRange(INT_MIN, INT_MAX);
            return sb;
        }

        case CSMWorld::ColumnBase::Display_Var:

            return new QLineEdit(parent);

        case CSMWorld::ColumnBase::Display_Float:
        {
            QDoubleSpinBox *dsb = new QDoubleSpinBox(parent);
            dsb->setRange(-FLT_MAX, FLT_MAX);
            dsb->setSingleStep(0.01f);
            dsb->setDecimals(3);
            return dsb;
        }

        case CSMWorld::ColumnBase::Display_LongString:
        {
            QPlainTextEdit *edit = new QPlainTextEdit(parent);
            edit->setUndoRedoEnabled (false);
            return edit;
        }

        case CSMWorld::ColumnBase::Display_Boolean:

            return new QCheckBox(parent);

        case CSMWorld::ColumnBase::Display_String:
        case CSMWorld::ColumnBase::Display_Skill:
        case CSMWorld::ColumnBase::Display_Script:
        case CSMWorld::ColumnBase::Display_Race:
        case CSMWorld::ColumnBase::Display_Region:
        case CSMWorld::ColumnBase::Display_Class:
        case CSMWorld::ColumnBase::Display_Faction:
        case CSMWorld::ColumnBase::Display_Miscellaneous:
        case CSMWorld::ColumnBase::Display_Sound:
        case CSMWorld::ColumnBase::Display_Mesh:
        case CSMWorld::ColumnBase::Display_Icon:
        case CSMWorld::ColumnBase::Display_Music:
        case CSMWorld::ColumnBase::Display_SoundRes:
        case CSMWorld::ColumnBase::Display_Texture:
        case CSMWorld::ColumnBase::Display_Video:
        case CSMWorld::ColumnBase::Display_GlobalVariable:

            return new DropLineEdit(parent);

        case CSMWorld::ColumnBase::Display_ScriptLines:

            return new ScriptEdit (mDocument, ScriptHighlighter::Mode_Console, parent);

        default:

            return QStyledItemDelegate::createEditor (parent, option, index);
    }
}
开发者ID:Kleptoid,项目名称:openmw,代码行数:80,代码来源:util.cpp


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