#1827 Manually produce context menu for message window in order to avoid Qt's default entries regarding input methods.

This commit is contained in:
sigurdp 2017-12-06 12:00:51 +01:00
parent 03aaa47a60
commit 8a35a53935

View File

@ -96,14 +96,23 @@ QSize RiuMessagePanel::sizeHint() const
//--------------------------------------------------------------------------------------------------
void RiuMessagePanel::slotShowContextMenu(const QPoint& pos)
{
QMenu* menu = m_textEdit->createStandardContextMenu();
QMenu menu;
menu->addSeparator();
menu->addAction("Clear All &Messages", this, SLOT(slotClearMessages()));
// Reworked from implemenmtation in QTextControl::createStandardContextMenu()
{
QAction* a = menu.addAction("&Copy", m_textEdit, SLOT(copy()), QKeySequence::Copy);
a->setEnabled(m_textEdit->textCursor().hasSelection());
}
{
menu.addSeparator();
QAction* a = menu.addAction("Select All", m_textEdit, SLOT(selectAll()), QKeySequence::SelectAll);
a->setEnabled(!m_textEdit->document()->isEmpty());
}
menu.addSeparator();
menu.addAction("Clear All &Messages", this, SLOT(slotClearMessages()));
menu->exec(m_textEdit->mapToGlobal(pos));
delete menu;
menu.exec(m_textEdit->mapToGlobal(pos));
}