Пример #1
0
  /*!
     * \class TextCursorCopyText
   * \author Anders Fernström
   * \date 2006-02-07
     *
     * \brief Command for pasting text
     */
  void TextCursorPasteText::execute()
  {
      Cell *cell = document()->getCursor()->currentCell();
      if( cell )
      {
        if( typeid(LatexCell) == typeid(*cell) )
        {
          LatexCell *latexcell = dynamic_cast<LatexCell*>(cell);
          if( latexcell->textEditOutput()->hasFocus() &&
            latexcell->isEvaluated() )
          {
            latexcell->textEditOutput()->paste();
          }
          else
          {
            latexcell->textEdit()->paste();
          }
        }
        else
        {
          QTextEdit *editor = cell->textEdit();
          if( editor )
          {
            editor->paste();
          }
        }

      }

  /*  QTextEdit *editor = document()->getCursor()->currentCell()->textEdit();
    if( editor )
    {
      editor->paste();
    }*/
  }
Пример #2
0
 /*!
    * \class TextCursorCopyText
  * \author Anders Fernström
  * \date 2006-02-07
    *
    * \brief Command for pasting text
    */
 void TextCursorPasteText::execute()
 {
   QTextEdit *editor = document()->getCursor()->currentCell()->textEdit();
   if( editor )
   {
     editor->paste();
   }
 }
Пример #3
0
    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);
            }
        }
    }
Пример #4
0
void CBaseEditWindow::paste( void )
{
	QTextEdit* doc = activeDocument();
	if( doc != NULL ) { doc->paste(); }
}
Пример #5
0
// 貼り付け
void MainWindow::textEditPaste() {
    QTextEdit* textEdit = getCurrentTextEdit();
    if (textEdit == NULL) return;
    textEdit->paste();
}