3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
13 The code for the ShortcutLineEdit class was adapted from
14 kkeysequencewidget.cpp, which is part of the KDE libraries.
15 Copyright (C) 1998 Mark Donohoe <donohoe@kde.org>
16 Copyright (C) 2001 Ellis Whitehead <ellis@kde.org>
17 Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
18 Licensed under version 2 of the General Public License and
19 used here in accordance with the terms of that license.
24 #include "CustomizedWidgets.h"
25 #include "GuiKeySymbol.h"
27 #include "support/qstring_helpers.h"
33 void ShortcutLineEdit::keyPressEvent(QKeyEvent * e)
37 case Qt::Key_AltGr: //or else we get unicode salad
45 uint modifierKeys = e->modifiers();
48 if (modifierKeys & Qt::SHIFT)
50 if (modifierKeys & Qt::CTRL)
52 if (modifierKeys & Qt::ALT)
56 setKeySymbol(&sym, e);
57 txt += toqstr(sym.getSymbolName());
62 setText(text() + " " + txt);
68 //prevent Qt from special casing Tab and Backtab
69 bool ShortcutLineEdit::event(QEvent* e)
71 if (e->type() == QEvent::ShortcutOverride)
74 if (e->type() == QEvent::KeyPress) {
75 keyPressEvent(static_cast<QKeyEvent *>(e));
79 return QLineEdit::event(e);
83 QString const SearchLineEdit::hintMessage() const
85 return toqstr("Search ...");
89 void SearchLineEdit::focusInEvent(QFocusEvent * e)
91 if (text() == hintMessage())
96 void SearchLineEdit::focusOutEvent(QFocusEvent * e)
99 setText(hintMessage());
103 #include "CustomizedWidgets_moc.cpp"