本文整理汇总了C++中QTextEdit::paste方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::paste方法的具体用法?C++ QTextEdit::paste怎么用?C++ QTextEdit::paste使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::paste方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
/*!
* \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: execute
/*!
* \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: 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);
}
}
}
示例4: paste
void CBaseEditWindow::paste( void )
{
QTextEdit* doc = activeDocument();
if( doc != NULL ) { doc->paste(); }
}
示例5: textEditPaste
// 貼り付け
void MainWindow::textEditPaste() {
QTextEdit* textEdit = getCurrentTextEdit();
if (textEdit == NULL) return;
textEdit->paste();
}