]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/CustomizedWidgets.h
495f56a3d1eefa61a35a4280bf731f9f1df3ecdf
[lyx.git] / src / frontends / qt4 / CustomizedWidgets.h
1 // -*- C++ -*-
2 /**
3  * \file CustomizedWidgets.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bo Peng
8  * \author Edwin Leuven
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef CUSTOMIZEDWIDGETS_H
14 #define CUSTOMIZEDWIDGETS_H
15
16 #include <QLineEdit>
17 #include "KeySequence.h"
18
19 class QEvent;
20 class QKeyEvent;
21
22 /**
23  * A lineedit for inputting shortcuts
24  */
25 class ShortcutLineEdit : public QLineEdit {
26         Q_OBJECT
27 public:
28         ShortcutLineEdit(QWidget * parent);
29         void reset();
30         bool eventFilter(QObject*, QEvent* e );
31         lyx::KeySequence const getKeySequence() const;
32 protected Q_SLOTS:
33         bool event(QEvent* e);
34         void keyPressEvent(QKeyEvent * e);
35 private:
36         void appendToSequence(QKeyEvent * e);
37         lyx::KeySequence keysequence_;
38         bool has_cursor_;
39 };
40
41
42 /**
43   * A lineedit that displays a hint message when there is no
44   * text and not under focus.
45   */
46 class SearchLineEdit : public QLineEdit {
47         Q_OBJECT
48 public:
49         QString const hintMessage() const;
50         SearchLineEdit(QWidget * parent) : QLineEdit(parent) {}
51 protected Q_SLOTS:
52         void focusInEvent(QFocusEvent * e);
53         void focusOutEvent(QFocusEvent * e);
54 };
55
56
57 #endif // CUSTOMIZEDWIDGETS_H