Beispiel #1
0
void CodeEditor::contextMenuEvent(QContextMenuEvent* event)
{
    QMenu menu(this);

    QAction* act = menu.addAction(tr("&Undo"), this, SLOT(undo()));       //, QKeySequence::Undo);
    act->setEnabled(document()->isUndoAvailable());
    act = menu.addAction(tr("&Redo"), this, SLOT(redo()));                //, QKeySequence::Redo);
    act->setEnabled(document()->isRedoAvailable());
    menu.addSeparator();
    act = menu.addAction(tr("Cu&t"),       this, SLOT(cut()));            //, QKeySequence::Cut);
    act->setEnabled(textCursor().hasSelection());
    act = menu.addAction(tr("&Copy"),      this, SLOT(copy()));           //, QKeySequence::Copy);
    act->setEnabled(textCursor().hasSelection());
    act = menu.addAction(tr("&Paste"),     this, SLOT(paste()));          //, QKeySequence::Paste);
    act->setEnabled(canPaste());
    act = menu.addAction(tr("Delete"),     this, SLOT(deleteSelected())); //, QKeySequence::Delete);
    act->setEnabled(textCursor().hasSelection());
    act = menu.addAction(tr("Select All"), this, SLOT(selectAll()));      //, QKeySequence::SelectAll);
    act->setEnabled(!document()->isEmpty());
    menu.addSeparator();
    menu.addAction(tr("Fold All"),   this, SLOT(foldAll()));
    menu.addAction(tr("Unfold All"), this, SLOT(unfoldAll()));
    menu.addSeparator();
    menu.addAction(tr("Toggle comment"), this, SLOT(toggleComment()));
    menu.addSeparator();
    menu.addAction(tr("UPPERCASE"), this, SLOT(toUpperCase()));
    menu.addAction(tr("lowercase"), this, SLOT(toLowerCase()));

    menu.exec(event->globalPos());
}
Beispiel #2
0
 void focusInEvent(QFocusEvent* event)
 {
   QTextEdit::focusInEvent(event);
   EditorWidget* editorWidget = (EditorWidget*)parent();
   if(editorWidget->pasteAct)
     editorWidget->pasteAct->setEnabled(canPaste());
 }
/**
 * @brief Shows a context menu.
 *
 * Reimplemented to replace the built-in undo/redo actions by actions that
 * pass through the QUndoStack.
 *
 * @param event The context menu event.
 */
void TextEditorWidget::contextMenuEvent(QContextMenuEvent* event) {

  // Create our own context menu with correct undo/redo actions.
  QMenu menu;
  QAction* action = nullptr;

  // Undo/Redo actions that use the undo stack.
  action = undo_stack.createUndoAction(this);
  action->setShortcut(QKeySequence::Undo);
  menu.addAction(action);
  action = undo_stack.createRedoAction(this);
  action->setShortcut(QKeySequence::Redo);
  menu.addAction(action);

  // Cut/Copy/Paste.
  menu.addSeparator();
  action = new QAction(tr("Cut"), this);
  action->setShortcut(QKeySequence::Cut);
  if (textCursor().selectedText().isEmpty()) {
    action->setEnabled(false);
  }
  else {
    connect(action, SIGNAL(triggered()),
            this, SLOT(cut()));
  }
  menu.addAction(action);

  action = new QAction(tr("Copy"), this);
  action->setShortcut(QKeySequence::Copy);
  if (textCursor().selectedText().isEmpty()) {
    action->setEnabled(false);
  }
  else {
    connect(action, SIGNAL(triggered()),
            this, SLOT(copy()));
  }
  menu.addAction(action);

  action = new QAction(tr("Paste"), this);
  action->setShortcut(QKeySequence::Paste);
  if (!canPaste()) {
    action->setEnabled(false);
  }
  else {
    connect(action, SIGNAL(triggered()),
            this, SLOT(paste()));
  }

  // Select all.
  menu.addAction(action);
  menu.addSeparator();
  action = new QAction(tr("Select all"), this);
  action->setShortcut(QKeySequence::SelectAll);
  connect(action, SIGNAL(triggered()),
          this, SLOT(selectAll()));
  menu.addAction(action);

  menu.exec(event->globalPos());
}
Beispiel #4
0
QMenu* ConsoleWidget::createEditMenu()
{
  QMenu* menu = new QMenu(tr("&Edit"));

  QAction* action = menu->addAction(QIcon(":/Icons/arrow_undo.png"), tr("&Undo"));
  action->setShortcut(QKeySequence(QKeySequence::Undo));
  action->setStatusTip(tr("Undo the last action"));
  action->setEnabled(canUndo);
  connect(action, SIGNAL(triggered()), this, SLOT(undo()));
  connect(this, SIGNAL(undoAvailable(bool)), action, SLOT(setEnabled(bool)));

  action = menu->addAction(QIcon(":/Icons/arrow_redo.png"), tr("&Redo"));
  action->setShortcut(QKeySequence(QKeySequence::Redo));
  action->setStatusTip(tr("Redo the previously undone action"));
  action->setEnabled(canRedo);
  connect(action, SIGNAL(triggered()), this, SLOT(redo()));
  connect(this, SIGNAL(redoAvailable(bool)), action, SLOT(setEnabled(bool)));

  menu->addSeparator();

  action = menu->addAction(QIcon(":/Icons/cut.png"), tr("Cu&t"));
  action->setShortcut(QKeySequence(QKeySequence::Cut));
  action->setStatusTip(tr("Cut the current selection's contents to the clipboard"));
  action->setEnabled(canCopy);
  connect(action, SIGNAL(triggered()), this, SLOT(cut()));
  connect(this, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool)));

  action = menu->addAction(QIcon(":/Icons/page_copy.png"), tr("&Copy"));
  action->setShortcut(QKeySequence(QKeySequence::Copy));
  action->setStatusTip(tr("Copy the current selection's contents to the clipboard"));
  action->setEnabled(canCopy);
  connect(action, SIGNAL(triggered()), this, SLOT(copy()));
  connect(this, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool)));

  action = menu->addAction(QIcon(":/Icons/page_paste.png"), tr("&Paste"));
  action->setShortcut(QKeySequence(QKeySequence::Paste));
  action->setStatusTip(tr("Paste the clipboard's contents into the current selection"));
  action->setEnabled(canPaste());
  connect(action, SIGNAL(triggered()), this, SLOT(paste()));
  connect(this, SIGNAL(pasteAvailable(bool)), action, SLOT(setEnabled(bool)));

  action = menu->addAction(tr("&Delete"));
  action->setShortcut(QKeySequence(QKeySequence::Delete));
  action->setStatusTip(tr("Delete the currently selected content"));
  action->setEnabled(canCopy);
  connect(action, SIGNAL(triggered()), this, SLOT(deleteText()));
  connect(this, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool)));

  menu->addSeparator();

  action = menu->addAction(tr("Select &All"));
  action->setShortcut(QKeySequence(QKeySequence::SelectAll));
  action->setStatusTip(tr("Select the whole text"));
  connect(action, SIGNAL(triggered()), this, SLOT(selectAll()));

  return menu;
}
Beispiel #5
0
void PaintArea::Copy()
{
    QRect select(_select.x() + 1, _select.y() + 1, _select.width() - 1, _select.height() - 1);
    _copy = image.copy(select);
    Undo();
    _history.push_back(image);
    emit enableUndo();
    emit canPaste();
    emit noCopy();
}
Beispiel #6
0
void PaintArea::Cut()
{
    Copy();
    QPainter painter(&image);
    painter.setBrush(Qt::white);
    painter.setPen(QPen(Qt::white, 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
    painter.drawRect(_select);
    update();
    _history.push_back(image);
    emit enableUndo();
    emit canPaste();
    emit noCopy();
}
void
Widget::contextMenu(QMenu* menu) const
{
    if(!menu) return;
    QAction* a;
    a=menu->addAction(tr("&Copy"),this,SLOT(copy()));
    a->setEnabled(canCopy());
    a=menu->addAction(tr("&Paste"),this,SLOT(paste()));
    a->setEnabled(canPaste());
    menu->addSeparator();
    a=menu->addAction(tr("Copy &All"),this,SLOT(copyAll()));
    menu->addSeparator();
    a=menu->addAction(tr("C&lear Scrollback"),this,SLOT(clearScrollback()));
    a=menu->addAction(tr("Rese&t Terminal"),this,SLOT(reset()));
    a=menu->addAction(tr("&Restart Session"),this,SLOT(restart()));
}
Beispiel #8
0
void DOHexEditor::paste()
{
	if(!canPaste()) return;

	std::string clipstr = wstring_to_utf8str(gClipboard.getPasteWString());
	const char* clip = clipstr.c_str();

	std::vector<U8> new_data;
	if(mInData)
	{
		int len = strlen(clip);
		for(int i = 0; (i + 1) < len; i += 2)
		{
			int c = 0;
			if(sscanf(&(clip[i]), "%02X", &c) != 1) break;
			new_data.push_back(U8(c));
		}
	}
	else
	{
		int len = strlen(clip);
		for(int i = 0; i < len; i++)
		{
			U8 c = 0;
			if(sscanf(&(clip[i]), "%c", &c) != 1) break;
			new_data.push_back(c);
		}
	}

	U32 start = mCursorPos;
	if(!mHasSelection)
		insert(start, new_data, TRUE);
	else
	{
		start = getProperSelectionStart();
		overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE);
	}

	moveCursor(start + new_data.size(), FALSE);
}
QMenu *
SimpleRichTextEdit::createContextMenu(const QPoint &mouseGlobalPos)
{
	Qt::TextInteractionFlags interactionFlags = this->textInteractionFlags();
	QTextDocument *document = this->document();
	QTextCursor cursor = textCursor();

	const bool showTextSelectionActions = (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse) & interactionFlags;

	QMenu *menu = new QMenu(this);

	if(interactionFlags & Qt::TextEditable) {
		m_actions[Undo]->setEnabled(document->isUndoAvailable());
		menu->addAction(m_actions[Undo]);

		m_actions[Redo]->setEnabled(document->isRedoAvailable());
		menu->addAction(m_actions[Redo]);

		menu->addSeparator();

		m_actions[Cut]->setEnabled(cursor.hasSelection());
		menu->addAction(m_actions[Cut]);
	}

	if(showTextSelectionActions) {
		m_actions[Copy]->setEnabled(cursor.hasSelection());
		menu->addAction(m_actions[Copy]);
	}

	if(interactionFlags & Qt::TextEditable) {
#if !defined(QT_NO_CLIPBOARD)
		m_actions[Paste]->setEnabled(canPaste());
		menu->addAction(m_actions[Paste]);
#endif
		m_actions[Delete]->setEnabled(cursor.hasSelection());
		menu->addAction(m_actions[Delete]);

		m_actions[Clear]->setEnabled(!document->isEmpty());
		menu->addAction(m_actions[Clear]);

		if(m_insertUnicodeControlCharMenu && interactionFlags & Qt::TextEditable) {
			menu->addSeparator();
			menu->addMenu(m_insertUnicodeControlCharMenu);
		}
	}

	if(showTextSelectionActions) {
		menu->addSeparator();

		m_actions[SelectAll]->setEnabled(!document->isEmpty());
		menu->addAction(m_actions[SelectAll]);
	}

	if(interactionFlags & Qt::TextEditable) {
		menu->addSeparator();

		m_actions[ToggleBold]->setCheckable(true);
		m_actions[ToggleBold]->setChecked(fontBold());
		menu->addAction(m_actions[ToggleBold]);

		m_actions[ToggleItalic]->setCheckable(true);
		m_actions[ToggleItalic]->setChecked(fontItalic());
		menu->addAction(m_actions[ToggleItalic]);

		m_actions[ToggleUnderline]->setCheckable(true);
		m_actions[ToggleUnderline]->setChecked(fontUnderline());
		menu->addAction(m_actions[ToggleUnderline]);

		m_actions[ToggleStrikeOut]->setCheckable(true);
		m_actions[ToggleStrikeOut]->setChecked(fontStrikeOut());
		menu->addAction(m_actions[ToggleStrikeOut]);

		menu->addAction(m_actions[ChangeTextColor]);

		menu->addSeparator();

		m_actions[CheckSpelling]->setEnabled(!document->isEmpty());
		menu->addAction(m_actions[CheckSpelling]);

		m_actions[ToggleAutoSpellChecking]->setChecked(checkSpellingEnabled());
		menu->addAction(m_actions[ToggleAutoSpellChecking]);

		if(checkSpellingEnabled()) {
			setupWordUnderPositionCursor(mouseGlobalPos);

			QString selectedWord = m_selectedWordCursor.selectedText();
			if(!selectedWord.isEmpty() && highlighter() && highlighter()->isWordMisspelled(selectedWord)) {
				QMenu *suggestionsMenu = menu->addMenu(i18n("Suggestions"));
				suggestionsMenu->addAction(i18n("Ignore"), this, SLOT(addToIgnoreList()));
				suggestionsMenu->addAction(i18n("Add to Dictionary"), this, SLOT(addToDictionary()));
				suggestionsMenu->addSeparator();
				QStringList suggestions = highlighter()->suggestionsForWord(m_selectedWordCursor.selectedText());
				if(suggestions.empty())
					suggestionsMenu->addAction(i18n("No suggestions"))->setEnabled(false);
				else {
					for(QStringList::ConstIterator it = suggestions.begin(), end = suggestions.end(); it != end; ++it)
						suggestionsMenu->addAction(*it, this, SLOT(replaceWithSuggestion()));
				}
			}
		}

		menu->addSeparator();

		m_actions[AllowTabulations]->setCheckable(true);
		m_actions[AllowTabulations]->setChecked(!tabChangesFocus());
		menu->addAction(m_actions[AllowTabulations]);
	}

	return menu;
}
Beispiel #10
0
void ConsoleWidget::copy()
{
  QTextEdit::copy();
  emit pasteAvailable(canPaste());
}
Beispiel #11
0
void ConsoleWidget::focusInEvent(QFocusEvent * event)
{
  QTextEdit::focusInEvent(event);
  emit pasteAvailable(canPaste());
}
Beispiel #12
0
void ConsoleWidget::keyPressEvent(QKeyEvent* event)
{
  switch(event->key())
  {
  case Qt::Key_Tab:
  case Qt::Key_Backtab:
    event->accept();
    {
      QTextCursor cursor = textCursor();
      int begin = cursor.position();
      int end = cursor.anchor();
      if(end < begin)
      {
        int tmp = end;
        end = begin;
        begin = tmp;
      }
      cursor.setPosition(end);
      cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
      QString line = cursor.selectedText();
      std::string command(line.toAscii().constData());
      std::string inputCommand = command;
      console.completeConsoleCommand(command, event->key() == Qt::Key_Tab, begin == end);
      if(command == inputCommand)
        QApplication::beep();
      else
      {
        QString newLine = command.c_str();
        int newBegin = cursor.position();
        int newEnd = newBegin + newLine.length();
        cursor.insertText(newLine);
        /*
        int i = 0;
        for(int len = std::min(line.length(), newLine.length()); i < len && line.at(i) == newLine.at(i); ++i);
        newBegin += i;
        */

        for(int i = command.length() - 2; i >= 0; --i)
        {
          char c = command[i];
          if(c == ' ' || c == ':' || c == '.')
          {
            newBegin += i + 1;
            break;
          }
        }

        cursor.setPosition(newBegin);
        cursor.setPosition(newEnd, QTextCursor::KeepAnchor);

        setTextCursor(cursor);
      }
    }
    break;

  case Qt::Key_Return:
  case Qt::Key_Enter:
    if(event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier))
    {
      QTextCursor cursor = textCursor();
      cursor.insertBlock();
      setTextCursor(cursor);
    }
    else
    {
      event->accept();
      {
        QTextCursor cursor = textCursor();
        cursor.movePosition(QTextCursor::StartOfBlock);
        cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
        QString line = cursor.selectedText();
        cursor.movePosition(QTextCursor::EndOfLine);
        if(cursor.atEnd())
          cursor.insertText("\n");
        cursor.movePosition(QTextCursor::NextBlock);
        setTextCursor(cursor);

        // save output for the case that the simulator crashes
        if(consoleView.loadAndSaveOutput)
        {
          QSettings& settings = RoboCupCtrl::application->getLayoutSettings();
          settings.beginGroup(consoleView.fullName);
          settings.setValue("Output", toPlainText());
          settings.endGroup();
          output.clear();
        }

        // execute the command
        console.executeConsoleCommand(line.toAscii().constData());

        // stores unix like history entry
        history.removeAll(line);
        history.append(line);
        history_iter = history.end();
      }
    }
    break;

  case Qt::Key_Right:
    { // avoid jumping to the next line when the right arrow key is used to accept suggestions from tab completion
      bool handled = false;
      if(event->modifiers() == 0)
      {
        QTextCursor cursor = textCursor();
        int position = cursor.position();
        if(position > cursor.anchor())
        {
          cursor.movePosition(QTextCursor::EndOfBlock);
          if(cursor.position() == position)
          {
            handled = true;
            setTextCursor(cursor);
          }
        }
      }
      if(!handled)
        QTextEdit::keyPressEvent(event);
    }
    break;

    // History browsing keys
  case Qt::Key_Up:
    if((event->modifiers() & Qt::ControlModifier)
       && !history.isEmpty() && history_iter != history.begin())
    {
      event->accept();
      history_iter--;
      QTextCursor cursor = textCursor();
      cursor.movePosition(QTextCursor::End);
      cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
      cursor.removeSelectedText();
      cursor.insertText(*history_iter);
      setTextCursor(cursor);
    }
    else
    {
      QTextEdit::keyPressEvent(event);
    }
    break;
  case Qt::Key_Down:
    if(event->modifiers() & Qt::ControlModifier)
    {
      event->accept();
      QTextCursor cursor = textCursor();
      cursor.movePosition(QTextCursor::End);
      cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
      cursor.removeSelectedText();
      if(!history.isEmpty() && history_iter != history.end())
      {
        history_iter++;
        if(history_iter != history.end())
        {
          cursor.insertText(*history_iter);
          setTextCursor(cursor);
        }
      }
    }
    else
    {
      QTextEdit::keyPressEvent(event);
    }
    break;

  default:
    QTextEdit::keyPressEvent(event);
    if(event->matches(QKeySequence::Copy) || event->matches(QKeySequence::Cut))
      emit pasteAvailable(canPaste());
    break;
  }
}
Beispiel #13
0
void pEditor::clipboardDataChanged()
{
    mPasteAvailable = !QApplication::clipboard()->text().isEmpty();
    emit pasteAvailable( canPaste() );
}
Beispiel #14
0
QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget *parent)
{
	Q_D(QWidgetTextControl);

	const bool showTextSelectionActions = d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);

	d->linkToCopy = QString();
	if (!pos.isNull())
		d->linkToCopy = anchorAt(pos);

	if (d->linkToCopy.isEmpty() && !showTextSelectionActions)
		return 0;

	QMenu *menu = new QMenu(parent);
	QAction *a;

	if (d->interactionFlags & Qt::TextEditable) {
		a = menu->addAction(tr("&Undo") + ACCEL_KEY(QKeySequence::Undo), this, SLOT(undo()));
		a->setEnabled(d->doc->isUndoAvailable());
		setActionIcon(a, QStringLiteral("edit-undo"));
		a = menu->addAction(tr("&Redo") + ACCEL_KEY(QKeySequence::Redo), this, SLOT(redo()));
		a->setEnabled(d->doc->isRedoAvailable());
		setActionIcon(a, QStringLiteral("edit-redo"));
		menu->addSeparator();

		a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut()));
		a->setEnabled(d->cursor.hasSelection());
		setActionIcon(a, QStringLiteral("edit-cut"));
	}

	if (showTextSelectionActions) {
		a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy()));
		a->setEnabled(d->cursor.hasSelection());
		setActionIcon(a, QStringLiteral("edit-copy"));
	}

	if ((d->interactionFlags & Qt::LinksAccessibleByKeyboard)
			|| (d->interactionFlags & Qt::LinksAccessibleByMouse)) {

		a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink()));
		a->setEnabled(!d->linkToCopy.isEmpty());
	}

	if (d->interactionFlags & Qt::TextEditable) {
#if !defined(QT_NO_CLIPBOARD)
		a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste()));
		a->setEnabled(canPaste());
		setActionIcon(a, QStringLiteral("edit-paste"));
#endif
		a = menu->addAction(tr("Delete"), this, SLOT(_q_deleteSelected()));
		a->setEnabled(d->cursor.hasSelection());
		setActionIcon(a, QStringLiteral("edit-delete"));
	}


	if (showTextSelectionActions) {
		menu->addSeparator();
		a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll()));
		a->setEnabled(!d->doc->isEmpty());
	}

	if ((d->interactionFlags & Qt::TextEditable) && qApp->styleHints()->useRtlExtensions()) {
		menu->addSeparator();
		QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu);
		menu->addMenu(ctrlCharacterMenu);
	}

	return menu;
}
Beispiel #15
0
int QDeclarativeTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDeclarativeImplicitSizePaintedItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 47)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 47;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QColor*>(_v) = color(); break;
        case 2: *reinterpret_cast< QColor*>(_v) = selectionColor(); break;
        case 3: *reinterpret_cast< QColor*>(_v) = selectedTextColor(); break;
        case 4: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 5: *reinterpret_cast< HAlignment*>(_v) = hAlign(); break;
        case 6: *reinterpret_cast< VAlignment*>(_v) = vAlign(); break;
        case 7: *reinterpret_cast< WrapMode*>(_v) = wrapMode(); break;
        case 8: *reinterpret_cast< int*>(_v) = lineCount(); break;
        case 9: *reinterpret_cast< qreal*>(_v) = paintedWidth(); break;
        case 10: *reinterpret_cast< qreal*>(_v) = paintedHeight(); break;
        case 11: *reinterpret_cast< TextFormat*>(_v) = textFormat(); break;
        case 12: *reinterpret_cast< bool*>(_v) = isReadOnly(); break;
        case 13: *reinterpret_cast< bool*>(_v) = isCursorVisible(); break;
        case 14: *reinterpret_cast< int*>(_v) = cursorPosition(); break;
        case 15: *reinterpret_cast< QRect*>(_v) = cursorRectangle(); break;
        case 16: *reinterpret_cast< QDeclarativeComponent**>(_v) = cursorDelegate(); break;
        case 17: *reinterpret_cast< int*>(_v) = selectionStart(); break;
        case 18: *reinterpret_cast< int*>(_v) = selectionEnd(); break;
        case 19: *reinterpret_cast< QString*>(_v) = selectedText(); break;
        case 20: *reinterpret_cast< bool*>(_v) = focusOnPress(); break;
        case 21: *reinterpret_cast< bool*>(_v) = persistentSelection(); break;
        case 22: *reinterpret_cast< qreal*>(_v) = textMargin(); break;
        case 23: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break;
        case 24: *reinterpret_cast< bool*>(_v) = selectByMouse(); break;
        case 25: *reinterpret_cast< SelectionMode*>(_v) = mouseSelectionMode(); break;
        case 26: *reinterpret_cast< bool*>(_v) = canPaste(); break;
        case 27: *reinterpret_cast< bool*>(_v) = isInputMethodComposing(); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setColor(*reinterpret_cast< QColor*>(_v)); break;
        case 2: setSelectionColor(*reinterpret_cast< QColor*>(_v)); break;
        case 3: setSelectedTextColor(*reinterpret_cast< QColor*>(_v)); break;
        case 4: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 5: setHAlign(*reinterpret_cast< HAlignment*>(_v)); break;
        case 6: setVAlign(*reinterpret_cast< VAlignment*>(_v)); break;
        case 7: setWrapMode(*reinterpret_cast< WrapMode*>(_v)); break;
        case 11: setTextFormat(*reinterpret_cast< TextFormat*>(_v)); break;
        case 12: setReadOnly(*reinterpret_cast< bool*>(_v)); break;
        case 13: setCursorVisible(*reinterpret_cast< bool*>(_v)); break;
        case 14: setCursorPosition(*reinterpret_cast< int*>(_v)); break;
        case 16: setCursorDelegate(*reinterpret_cast< QDeclarativeComponent**>(_v)); break;
        case 20: setFocusOnPress(*reinterpret_cast< bool*>(_v)); break;
        case 21: setPersistentSelection(*reinterpret_cast< bool*>(_v)); break;
        case 22: setTextMargin(*reinterpret_cast< qreal*>(_v)); break;
        case 23: setInputMethodHints(*reinterpret_cast< Qt::InputMethodHints*>(_v)); break;
        case 24: setSelectByMouse(*reinterpret_cast< bool*>(_v)); break;
        case 25: setMouseSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 5: resetHAlign(); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 28;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}