mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
Some improvements.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24493 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
26e958bac7
commit
7a24384e6d
@ -304,20 +304,18 @@ bool GuiSelectionManager::eventFilter(QObject * obj, QEvent * event)
|
||||
// Ctrl-Enter will add it and close the dialog.
|
||||
// This is designed to work both with the main enter key
|
||||
// and the one on the numeric keypad.
|
||||
if ((keyPressed == Qt::Key_Enter || keyPressed == Qt::Key_Return) &&
|
||||
//We want one or both of Control and Keypad, and nothing else
|
||||
//(KeypadModifier is what you get if you use the Enter key on the
|
||||
//numeric keypad.)
|
||||
(!keyModifiers ||
|
||||
(keyModifiers == Qt::ControlModifier) ||
|
||||
if (keyPressed == Qt::Key_Enter || keyPressed == Qt::Key_Return) {
|
||||
if (!keyModifiers)
|
||||
addPB_clicked();
|
||||
else if ((keyModifiers == Qt::ControlModifier) ||
|
||||
(keyModifiers == Qt::KeypadModifier) ||
|
||||
(keyModifiers == (Qt::ControlModifier | Qt::KeypadModifier))
|
||||
)
|
||||
) {
|
||||
if (addPB->isEnabled()) {
|
||||
addPB_clicked();
|
||||
okHook(); //signal
|
||||
}
|
||||
}
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
@ -330,17 +328,29 @@ bool GuiSelectionManager::eventFilter(QObject * obj, QEvent * event)
|
||||
int const keyPressed = keyEvent->key();
|
||||
Qt::KeyboardModifiers const keyModifiers = keyEvent->modifiers();
|
||||
if (keyPressed == Qt::Key_Delete || keyPressed == Qt::Key_Backspace) {
|
||||
if (keyModifiers == Qt::NoModifier && deletePB->isEnabled())
|
||||
if (keyModifiers == Qt::NoModifier && deletePB->isEnabled()) {
|
||||
deletePB_clicked();
|
||||
else if (keyModifiers == Qt::ControlModifier) {
|
||||
updateHook();
|
||||
} else if (keyModifiers == Qt::ControlModifier) {
|
||||
selectedModel->removeRows(0, selectedModel->rowCount());
|
||||
updateHook();
|
||||
} else
|
||||
//ignore it otherwise
|
||||
return QObject::eventFilter(obj, event);
|
||||
} else if (keyPressed == Qt::Key_Up) {
|
||||
if (keyModifiers == Qt::ControlModifier) {
|
||||
if (upPB->isEnabled())
|
||||
upPB_clicked();
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
} else if (keyPressed == Qt::Key_Down) {
|
||||
if (keyModifiers == Qt::ControlModifier) {
|
||||
if (downPB->isEnabled())
|
||||
downPB_clicked();
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user