Console class reference
[Base module]
Declaration
#include <QtLua/Console>
namespace QtLua {
class Console;
};
This class is a member of the QtLua namespace.
This class is declared in QtLua/qtluaconsole.hh source file, line 56.
Description
This class provides an easy to use console widget for use in QtLua based applications.
This widget is a general purpose console widget with history and completion capabilities.
The qtlua interpreter uses this widget.
When used with a State lua interpreter object, it only needs a few signals connections to get a working lua based shell:
// code from examples/cpp/console/console.cc:25
MainWindow::MainWindow()
: QMainWindow()
{
state = new QtLua::State();
console = new QtLua::Console();
setCentralWidget(console);
connect(console, SIGNAL(line_validate(const QString&)),
state, SLOT(exec(const QString&)));
connect(console, SIGNAL(get_completion_list(const QString &, QStringList &, int &)),
state, SLOT(fill_completion_list(const QString &, QStringList &, int &)));
connect(state, SIGNAL(output(const QString&)),
console, SLOT(print(const QString&)));
}
Members
Functions
- Console(QWidget *parent = [...], const QString &prompt = [...], const QStringList &history = [...])
- const QStringList & get_history() const
- int get_history_size() const
- const QString & get_prompt() const
- int get_scroll_back() const
- int get_text_height() const
- int get_text_width() const
- void load_history(QSettings &s, const QString &key = [...])
- void save_history(QSettings &s, const QString &key = [...]) const
- void set_completion_regexp(const QRegExp ®exp)
- void set_history(const QStringList &h)
- void set_history_size(int history_size)
- void set_prompt(const QString &p)
- void set_scroll_back(int scroll_back)
- void set_text_height(int height)
- void set_text_width(int width)
Private functions
- void action_end()
- void action_history_down()
- void action_history_find(int direction)
- void action_history_up()
- void action_home()
- void action_key_complete()
- void action_key_enter()
- void delete_completion_list()
- void display_prompt()
- void init()
- void keyPressEvent(QKeyEvent *e)
- void mouseDoubleClickEvent(QMouseEvent *e)
- void mousePressEvent(QMouseEvent *e)
- void mouseReleaseEvent(QMouseEvent *e)
- void print_flush()
- QSize sizeHint() const
- void timerEvent(QTimerEvent *event)
Slot
- void print(const QString &str)
Signals
- void get_completion_list(const QString &prefix, QStringList &list, int &cursor_offset)
- void line_validate(const QString &str)
Private fields
- QRegExp _complete_re
- int _complete_start
- int _cursor_pos
- QTextCharFormat _fmt_normal
- QStringList _history
- int _history_ndx
- int _history_size
- int _line_start
- int _mark
- QString _print_buffer
- int _print_timer
- QString _prompt
- int _prompt_start
- int _scroll_back
- int _text_height
- int _text_width
Members detail
Console(QWidget *parent = 0, const QString &prompt = QString("$"), const QStringList &history = QStringList())
This constructor is declared in QtLua/qtluaconsole.hh source file, line 68.
Create a console widget and restore history
QRegExp _complete_re
This variable is declared in QtLua/qtluaconsole.hh source file, line 151.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 142.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 150.
This member access is private.
QTextCharFormat _fmt_normal
This variable is declared in QtLua/qtluaconsole.hh source file, line 141.
This member access is private.
QStringList _history
This variable is declared in QtLua/qtluaconsole.hh source file, line 147.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 148.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 149.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 144.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 145.
This member access is private.
QString _print_buffer
This variable is declared in QtLua/qtluaconsole.hh source file, line 154.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 155.
This member access is private.
QString _prompt
This variable is declared in QtLua/qtluaconsole.hh source file, line 146.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 143.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 156.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 153.
This member access is private.
This variable is declared in QtLua/qtluaconsole.hh source file, line 152.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 170.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 165.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 166.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 164.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 169.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 162.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 163.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 168.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 167.
This member access is private.
void get_completion_list(const QString &prefix, QStringList &list, int &cursor_offset)
This Qt signal is declared in QtLua/qtluaconsole.hh source file, line 132.
This member is a Qt signal.
Signal emited to query completion list.
Parameters list:
- prefix: text extracted before cursor.
- list: must be filled with completion matches by completion slot function.
- cursor_offset: may be decreased by completion slot function to move cursor backward on completed text. (only used on single match)
const QStringList & get_history() const
This function is declared in QtLua/qtluaconsole.hh source file, line 98.
Get current history.
This function is declared in QtLua/qtluaconsole.hh source file, line 88.
Get console max history entries count
const QString & get_prompt() const
This function is declared in QtLua/qtluaconsole.hh source file, line 73.
Get console prompt.
This function is declared in QtLua/qtluaconsole.hh source file, line 95.
Get number of lines in the scrollback buffer.
This function is declared in QtLua/qtluaconsole.hh source file, line 83.
Get console height in character count
This function is declared in QtLua/qtluaconsole.hh source file, line 78.
Get console width in character count
This function is declared in QtLua/qtluaconsole.hh source file, line 160.
This member access is private.
void keyPressEvent(QKeyEvent *e)
This function is declared in QtLua/qtluaconsole.hh source file, line 180.
This member access is private.
void line_validate(const QString &str)
This Qt signal is declared in QtLua/qtluaconsole.hh source file, line 124.
This member is a Qt signal.
Signal emited when text line is validated with enter key
This function is declared in QtLua/qtluaconsole.hh source file, line 105.
Load history from QSettings object and keep a QPointer to QSettings for subsequent call to the Console::save_history function.
void mouseDoubleClickEvent(QMouseEvent *e)
This function is declared in QtLua/qtluaconsole.hh source file, line 176.
This member access is private.
void mousePressEvent(QMouseEvent *e)
This function is declared in QtLua/qtluaconsole.hh source file, line 174.
This member access is private.
void mouseReleaseEvent(QMouseEvent *e)
This function is declared in QtLua/qtluaconsole.hh source file, line 175.
This member access is private.
void print(const QString &str)
This Qt slot is declared in QtLua/qtluaconsole.hh source file, line 137.
This member is a Qt slot.
Display text on the console
This function is declared in QtLua/qtluaconsole.hh source file, line 171.
This member access is private.
This function is declared in QtLua/qtluaconsole.hh source file, line 109.
Save history using QSettings object previously passed to Console::load_history function.
void set_completion_regexp(const QRegExp ®exp)
This function is declared in QtLua/qtluaconsole.hh source file, line 119.
Set Qt regular expression used to extract text before cursor to pass to completion signal.
The default regexp [_.:a-zA-Z0-9]+$ is suited to extract lua identifiers and table member access statements.
void set_history(const QStringList &h)
This function is declared in QtLua/qtluaconsole.hh source file, line 101.
Set current history.
This function is declared in QtLua/qtluaconsole.hh source file, line 86.
Set console max history entries count
void set_prompt(const QString &p)
This function is declared in QtLua/qtluaconsole.hh source file, line 71.
Set console prompt.
This function is declared in QtLua/qtluaconsole.hh source file, line 93.
Set number of lines in the scrollback buffer. Changes will take effect next time a line is entered or a Console::print is performed. Default value is 1000.
This function is declared in QtLua/qtluaconsole.hh source file, line 81.
Set console height in character count
This function is declared in QtLua/qtluaconsole.hh source file, line 76.
Set console width in character count
QSize sizeHint() const
This function is declared in QtLua/qtluaconsole.hh source file, line 158.
This member access is private.
void timerEvent(QTimerEvent *event)
This function is declared in QtLua/qtluaconsole.hh source file, line 177.
This member access is private.