equal
deleted
inserted
replaced
52 qreal textWidth(); |
52 qreal textWidth(); |
53 void setCursorPosition(int pos); |
53 void setCursorPosition(int pos); |
54 bool hasSelection() { return (cursorX()!= anchorX()); } |
54 bool hasSelection() { return (cursorX()!= anchorX()); } |
55 Qt::InputMethodHints inputMethodHints() const { return m_hints; } |
55 Qt::InputMethodHints inputMethodHints() const { return m_hints; } |
56 void setInputMethodHints(Qt::InputMethodHints hints); |
56 void setInputMethodHints(Qt::InputMethodHints hints); |
|
57 void setSpecificButton(QString& commitString, QString& buttonIconPath); |
57 |
58 |
58 protected: |
59 protected: |
59 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); |
60 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); |
60 virtual void keyPressEvent(QKeyEvent * event); |
61 virtual void keyPressEvent(QKeyEvent * event); |
61 virtual void keyReleaseEvent(QKeyEvent * event); |
62 virtual void keyReleaseEvent(QKeyEvent * event); |
66 virtual void focusOutEvent(QFocusEvent * event); |
67 virtual void focusOutEvent(QFocusEvent * event); |
67 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); |
68 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); |
68 |
69 |
69 private slots: |
70 private slots: |
70 void contentsChange(int position, int charsRemoved, int charsAdded); |
71 void contentsChange(int position, int charsRemoved, int charsAdded); |
|
72 void specificBtnTriggered(bool checked); |
71 |
73 |
72 signals: |
74 signals: |
73 void cursorXChanged(qreal newx); |
75 void cursorXChanged(qreal newx); |
74 void textMayChanged(); |
76 void textMayChanged(); |
75 void focusChanged(bool focusIn); |
77 void focusChanged(bool focusIn); |
78 private: |
80 private: |
79 QTextLine m_textLine; |
81 QTextLine m_textLine; |
80 int m_defaultStartDragDistance; |
82 int m_defaultStartDragDistance; |
81 int m_maxTextLength; |
83 int m_maxTextLength; |
82 Qt::InputMethodHints m_hints; |
84 Qt::InputMethodHints m_hints; |
|
85 bool m_setSpecificBtn; |
|
86 QString m_spBtnCommitString; |
|
87 QString m_spBtnIconPath; |
83 }; |
88 }; |
84 |
89 |
85 class GLineEditor : public QGraphicsWidget |
90 class GLineEditor : public QGraphicsWidget |
86 { |
91 { |
87 Q_OBJECT |
92 Q_OBJECT |
108 bool hasSelection() { return m_editor->hasSelection(); } |
113 bool hasSelection() { return m_editor->hasSelection(); } |
109 Qt::InputMethodHints inputMethodHints() { return m_editor->inputMethodHints(); } |
114 Qt::InputMethodHints inputMethodHints() { return m_editor->inputMethodHints(); } |
110 // Calling this function will overwrite the existing hints |
115 // Calling this function will overwrite the existing hints |
111 void setInputMethodHints(Qt::InputMethodHints hints) { m_editor->setInputMethodHints(hints); } |
116 void setInputMethodHints(Qt::InputMethodHints hints) { m_editor->setInputMethodHints(hints); } |
112 void setMaxTextLength(int length) { m_editor->setMaxTextLength(length); } |
117 void setMaxTextLength(int length) { m_editor->setMaxTextLength(length); } |
|
118 void setSpecificButton(QString commitString, QString buttonIcon) { m_editor->setSpecificButton(commitString, buttonIcon);} |
113 |
119 |
114 protected: |
120 protected: |
115 virtual bool eventFilter(QObject * object, QEvent * event); |
121 virtual bool eventFilter(QObject * object, QEvent * event); |
116 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); |
122 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); |
117 virtual void resizeEvent(QGraphicsSceneResizeEvent * event); |
123 virtual void resizeEvent(QGraphicsSceneResizeEvent * event); |