QWidgetTextControl: add object names for standard context menu actions

Mainly for auto testing purposes.

Change-Id: I776f9d7f28f9a04ba3f9a6bbc549d6e86bece876
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
J-P Nurmi 2015-02-13 14:11:20 +01:00
parent b6b5ba0e23
commit 25e19acca6

View File

@ -2227,15 +2227,18 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
if (d->interactionFlags & Qt::TextEditable) { if (d->interactionFlags & Qt::TextEditable) {
a = menu->addAction(tr("&Undo") + ACCEL_KEY(QKeySequence::Undo), this, SLOT(undo())); a = menu->addAction(tr("&Undo") + ACCEL_KEY(QKeySequence::Undo), this, SLOT(undo()));
a->setEnabled(d->doc->isUndoAvailable()); a->setEnabled(d->doc->isUndoAvailable());
a->setObjectName(QStringLiteral("edit-undo"));
setActionIcon(a, QStringLiteral("edit-undo")); setActionIcon(a, QStringLiteral("edit-undo"));
a = menu->addAction(tr("&Redo") + ACCEL_KEY(QKeySequence::Redo), this, SLOT(redo())); a = menu->addAction(tr("&Redo") + ACCEL_KEY(QKeySequence::Redo), this, SLOT(redo()));
a->setEnabled(d->doc->isRedoAvailable()); a->setEnabled(d->doc->isRedoAvailable());
a->setObjectName(QStringLiteral("edit-redo"));
setActionIcon(a, QStringLiteral("edit-redo")); setActionIcon(a, QStringLiteral("edit-redo"));
menu->addSeparator(); menu->addSeparator();
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut())); a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut()));
a->setEnabled(d->cursor.hasSelection()); a->setEnabled(d->cursor.hasSelection());
a->setObjectName(QStringLiteral("edit-cut"));
setActionIcon(a, QStringLiteral("edit-cut")); setActionIcon(a, QStringLiteral("edit-cut"));
#endif #endif
} }
@ -2244,6 +2247,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
if (showTextSelectionActions) { if (showTextSelectionActions) {
a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy())); a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy()));
a->setEnabled(d->cursor.hasSelection()); a->setEnabled(d->cursor.hasSelection());
a->setObjectName(QStringLiteral("edit-copy"));
setActionIcon(a, QStringLiteral("edit-copy")); setActionIcon(a, QStringLiteral("edit-copy"));
} }
@ -2252,6 +2256,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink())); a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink()));
a->setEnabled(!d->linkToCopy.isEmpty()); a->setEnabled(!d->linkToCopy.isEmpty());
a->setObjectName(QStringLiteral("link-copy"));
} }
#endif // QT_NO_CLIPBOARD #endif // QT_NO_CLIPBOARD
@ -2259,10 +2264,12 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste())); a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste()));
a->setEnabled(canPaste()); a->setEnabled(canPaste());
a->setObjectName(QStringLiteral("edit-paste"));
setActionIcon(a, QStringLiteral("edit-paste")); setActionIcon(a, QStringLiteral("edit-paste"));
#endif #endif
a = menu->addAction(tr("Delete"), this, SLOT(_q_deleteSelected())); a = menu->addAction(tr("Delete"), this, SLOT(_q_deleteSelected()));
a->setEnabled(d->cursor.hasSelection()); a->setEnabled(d->cursor.hasSelection());
a->setObjectName(QStringLiteral("edit-delete"));
setActionIcon(a, QStringLiteral("edit-delete")); setActionIcon(a, QStringLiteral("edit-delete"));
} }
@ -2271,6 +2278,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget
menu->addSeparator(); menu->addSeparator();
a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll())); a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll()));
a->setEnabled(!d->doc->isEmpty()); a->setEnabled(!d->doc->isEmpty());
a->setObjectName(QStringLiteral("select-all"));
} }
if ((d->interactionFlags & Qt::TextEditable) && qApp->styleHints()->useRtlExtensions()) { if ((d->interactionFlags & Qt::TextEditable) && qApp->styleHints()->useRtlExtensions()) {