#include <IOWidget.h>
Public Slots | |
| void | addPrompt () |
| addPrompt Adds the prompt to the text edit and unlocks the widget for input More... | |
| void | append (QString text) |
| append Appends the given text to the text edit and locks the widget for input More... | |
Signals | |
| void | command (QString command) |
| command Signal emitted when input is entered. More... | |
Public Member Functions | |
| IOWidget (QWidget *parent=0) | |
| QString | prompt () const |
| prompt Retrieves the current prompt. More... | |
| void | setPrompt (const QString &prompt) |
| setPrompt Sets a new prompt from a given string. More... | |
Protected Member Functions | |
| void | keyPressEvent (QKeyEvent *e) |
Private Member Functions | |
| void | clearLine () |
| clearLine Clears the line under the cursor. More... | |
| QString | getCommand () const |
| getCommand Gets the input from the user. More... | |
| int | getIndex (const QTextCursor &cursor) |
| getIndex Gets the index of a given cursor. More... | |
| void | handleEnter () |
| handleEnter Handles Enter and Return key press. More... | |
| void | handleHome () |
| handleHome Handles Home key press. More... | |
| void | handleLeft (QKeyEvent *event) |
| handleLeft Handles Left arrow key press. More... | |
| bool | isWritable (const QTextCursor &cursor) |
| isWritable Checks if a given cursor is at a writable position. More... | |
Private Attributes | |
| int | lastIndex |
| lastIndex The index of the last character. More... | |
| bool | locked |
| locked False if the text edit can receive input, true otherwise. More... | |
| QString | userPrompt |
| userPrompt prompt to indicate that the text edit is waiting for input More... | |
Definition at line 46 of file IOWidget.h.
| te::qt::widgets::IOWidget::IOWidget | ( | QWidget * | parent = 0 | ) |
Definition at line 37 of file IOWidget.cpp.
References getIndex(), and lastIndex.
|
slot |
addPrompt Adds the prompt to the text edit and unlocks the widget for input
Definition at line 88 of file IOWidget.cpp.
References locked, and userPrompt.
|
slot |
append Appends the given text to the text edit and locks the widget for input
| text | String to be appended |
Definition at line 96 of file IOWidget.cpp.
References getIndex(), lastIndex, and locked.
Referenced by te::ce::CodeEditorDialog::onRunFinished().
|
private |
clearLine Clears the line under the cursor.
Definition at line 104 of file IOWidget.cpp.
Referenced by setPrompt().
|
signal |
command Signal emitted when input is entered.
| command | String to be emitted. |
Referenced by handleEnter().
|
private |
getCommand Gets the input from the user.
Definition at line 111 of file IOWidget.cpp.
References lastIndex, and userPrompt.
Referenced by handleEnter().
|
private |
getIndex Gets the index of a given cursor.
| cursor | Cursor used to retrieve the index. |
Definition at line 139 of file IOWidget.cpp.
References b.
Referenced by append(), handleEnter(), handleLeft(), IOWidget(), and isWritable().
|
private |
handleEnter Handles Enter and Return key press.
Definition at line 68 of file IOWidget.cpp.
References command(), getCommand(), getIndex(), lastIndex, and prompt().
Referenced by keyPressEvent().
|
private |
handleHome Handles Home key press.
Definition at line 130 of file IOWidget.cpp.
References te::at::Right, and userPrompt.
Referenced by keyPressEvent().
|
private |
handleLeft Handles Left arrow key press.
| event | The received event. |
Definition at line 122 of file IOWidget.cpp.
References getIndex(), and userPrompt.
Referenced by keyPressEvent().
|
private |
isWritable Checks if a given cursor is at a writable position.
| cursor | Cursor that will be checked. |
Definition at line 159 of file IOWidget.cpp.
References te::at::End, getIndex(), locked, and prompt().
Referenced by keyPressEvent().
|
protected |
Definition at line 44 of file IOWidget.cpp.
References handleEnter(), handleHome(), handleLeft(), and isWritable().
| QString te::qt::widgets::IOWidget::prompt | ( | ) | const |
prompt Retrieves the current prompt.
Definition at line 154 of file IOWidget.cpp.
References userPrompt.
Referenced by handleEnter(), isWritable(), and setPrompt().
| void te::qt::widgets::IOWidget::setPrompt | ( | const QString & | prompt | ) |
setPrompt Sets a new prompt from a given string.
| prompt | String of the new prompt |
Definition at line 148 of file IOWidget.cpp.
References clearLine(), prompt(), and userPrompt.
|
private |
lastIndex The index of the last character.
Definition at line 121 of file IOWidget.h.
Referenced by append(), getCommand(), handleEnter(), and IOWidget().
|
private |
locked False if the text edit can receive input, true otherwise.
Definition at line 116 of file IOWidget.h.
Referenced by addPrompt(), append(), and isWritable().
|
private |
userPrompt prompt to indicate that the text edit is waiting for input
Definition at line 110 of file IOWidget.h.
Referenced by addPrompt(), getCommand(), handleHome(), handleLeft(), prompt(), and setPrompt().