forked from altairwei/WizNotePlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
titleedit.h
51 lines (37 loc) · 1.03 KB
/
titleedit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef CORE_TITLEEDIT_H
#define CORE_TITLEEDIT_H
#include <QLineEdit>
class QCompleter;
class QModelIndex;
class QInputMethodEvent;
namespace Core {
class CWizDocumentView;
namespace Internal {
class TitleEdit : public QLineEdit
{
Q_OBJECT
public:
explicit TitleEdit(QWidget *parent);
void resetTitle(const QString& strTitle);
void setReadOnly(bool b);
void setCompleter(QCompleter* completer);
QCompleter* completer() const { return c; }
protected:
QSize sizeHint() const;
virtual void inputMethodEvent(QInputMethodEvent* event);
virtual void keyPressEvent(QKeyEvent* e);
private:
QCompleter* c;
QChar m_separator;
void updateCompleterPopupItems(const QString& completionPrefix);
QString textUnderCursor();
QChar charBeforeCursor();
CWizDocumentView* noteView();
private Q_SLOTS:
void onInsertCompletion(const QModelIndex &index);
void onTitleEditingFinished();
void onTitleReturnPressed();
};
} // namespace Internal
} // namespace Core
#endif // CORE_TITLEEDIT_H