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


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

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


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

示例1: editMenuActivated

    void editMenuActivated(QAction *action)
    {
        QWidget* w = qApp->focusWidget();
        QTextEdit* te = qobject_cast<QTextEdit*>(w);
        QLineEdit* le = qobject_cast<QLineEdit*>(w);

        if (action == selectAction) {
            highlighting = this;
            return;
        }
        highlighting = 0;

        if (action == copyAction) {
            if (te) {
                if (te->hasEditFocus()) {
                    te->copy();
                } else {
                    QTextCursor c = te->textCursor();
                    te->selectAll();
                    te->copy();
                    te->setTextCursor(c);   // reset selection
                }
            } else if (le) {
                if (le->hasEditFocus()) {
                    le->copy();
                } else {
                    qApp->clipboard()->setText(le->text());
                }
            }
        } else if (action == pasteAction) {
            // assumes clipboard is not empty if 'Paste' is able to be
            // activated, otherwise the line/textedit might be cleared
            // without pasting anything back into it
            if (te) {
                if (!te->hasEditFocus())
                    te->clear();
                te->paste();
                if (!te->hasEditFocus()) {
                    te->moveCursor(QTextCursor::Start);
                    te->ensureCursorVisible();
                }
            } else if (le) {
                if (!le->hasEditFocus())
                    le->clear();
                le->paste();
                if (!le->hasEditFocus())
                    le->home(false);
            }
        }
    }
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:50,代码来源:qsoftmenubar.cpp

示例2: execute

 /*!
    * \class TextCursorCopyText
  * \author Anders Fernström
  * \date 2006-02-07
    *
    * \brief Command for copying text
    */
 void TextCursorCopyText::execute()
 {
   Cell *cell = document()->getCursor()->currentCell();
   if( cell )
   {
     if( typeid(InputCell) == typeid(*cell) )
     {
       InputCell *inputcell = dynamic_cast<InputCell*>(cell);
       if( inputcell->textEditOutput()->hasFocus() &&
         inputcell->isEvaluated() )
       {
         inputcell->textEditOutput()->copy();
       }
       else
         inputcell->textEdit()->copy();
     }
     else if( typeid(GraphCell) == typeid(*cell) )
     {
       GraphCell *graphcell = dynamic_cast<GraphCell*>(cell);
       if( graphcell->textEditOutput()->hasFocus() &&
         graphcell->isEvaluated() )
       {
         graphcell->textEditOutput()->copy();
       }
       else
         graphcell->textEdit()->copy();
     }
     else if( typeid(LatexCell) == typeid(*cell) )
     {
       LatexCell *latexcell = dynamic_cast<LatexCell*>(cell);
       if( latexcell->textEditOutput()->hasFocus() &&
         latexcell->isEvaluated() )
       {
         latexcell->textEditOutput()->copy();
       }
       else
         latexcell->textEdit()->copy();
     }
     else
     {
       QTextEdit *editor = cell->textEdit();
       if( editor )
       {
         editor->copy();
       }
     }
   }
 }
开发者ID:adrpo,项目名称:OMNotebook,代码行数:55,代码来源:textcursorcommands.cpp

示例3: copy

void CBaseEditWindow::copy( void )
{
	QTextEdit* doc = activeDocument();
	if( doc != NULL ) { doc->copy(); }
}
开发者ID:lgarest,项目名称:42,代码行数:5,代码来源:editwindow.cpp

示例4: textEditCopy

// コピー
void MainWindow::textEditCopy() {
    QTextEdit* textEdit = getCurrentTextEdit();
    if (textEdit == NULL) return;
    textEdit->copy();
}
开发者ID:furaga,项目名称:CPUExSolver,代码行数:6,代码来源:edit.cpp


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