27 : ChromeSnippet( elementId, chrome, widget, element ) |
27 : ChromeSnippet( elementId, chrome, widget, element ) |
28 { |
28 { |
29 connectAll(); |
29 connectAll(); |
30 } |
30 } |
31 |
31 |
32 void EditorSnippet::setWidget(QGraphicsWidget * widget){ |
32 void EditorSnippet::setChromeWidget(QGraphicsWidget * widget){ |
33 ChromeSnippet::setWidget(widget); |
33 ChromeSnippet::setChromeWidget(widget); |
34 connectAll(); |
34 connectAll(); |
35 } |
35 } |
36 |
36 |
|
37 EditorSnippet * EditorSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element) |
|
38 { |
|
39 EditorSnippet* that = new EditorSnippet(elementId, chrome, 0, element); |
|
40 that->setChromeWidget( new TextEditItem( that, chrome ) ); |
|
41 return that; |
|
42 } |
|
43 |
37 void EditorSnippet::connectAll(){ |
44 void EditorSnippet::connectAll(){ |
38 if(m_widget){ |
45 if(m_widget){ |
39 GTextEditor * editor = static_cast<TextEditItem*>(m_widget)->editor(); |
46 GTextEditor * editor = static_cast<TextEditItem*>(m_widget)->editor(); |
40 connect(editor, SIGNAL(textMayChanged()), this, SIGNAL(textChanged())); |
47 connect(editor, SIGNAL(textMayChanged()), this, SIGNAL(textChanged())); |
41 connect(editor, SIGNAL(activated()), this, SIGNAL(activated())); |
48 connect(editor, SIGNAL(activated()), this, SIGNAL(activated())); |
80 } |
87 } |
81 |
88 |
82 void EditorSnippet::unselect(){ |
89 void EditorSnippet::unselect(){ |
83 return static_cast<TextEditItem*>(m_widget)->unselect(); |
90 return static_cast<TextEditItem*>(m_widget)->unselect(); |
84 } |
91 } |
|
92 |
|
93 int EditorSnippet::getTextOptions(){ |
|
94 return (int) static_cast<TextEditItem*>(m_widget)->getTextOptions(); |
|
95 } |
|
96 |
|
97 void EditorSnippet::setTextOptions(int flag){ |
|
98 return static_cast<TextEditItem*>(m_widget)->setTextOptions(flag); |
|
99 } |
|
100 |
|
101 void EditorSnippet::setMaxTextLength(int length){ |
|
102 return static_cast<TextEditItem*>(m_widget)->setMaxTextLength(length); |
|
103 } |
85 } |
104 } |