This class implements the history for the Python console. More...
#include <PythonConsole.h>
Public Member Functions | |
void | append (const QString &inputLine) |
ConsoleHistory () | |
void | doScratch (void) |
doScratch removes the tail of the history list, starting from the index marked lately. More... | |
void | first () |
bool | isEmpty () const |
void | markScratch (void) |
markScratch stores the current end index of the history list. More... | |
bool | more () |
bool | next () |
next switches the history pointer to the next item. More... | |
bool | prev (const QString &prefix=QString()) |
prev switches the history pointer to the previous item. More... | |
void | restart () |
restart resets the history access to the latest item. More... | |
const QString & | value () const |
const QStringList & | values () const |
~ConsoleHistory () | |
Detailed Description
This class implements the history for the Python console.
Constructor & Destructor Documentation
◆ ConsoleHistory()
ConsoleHistory::ConsoleHistory | ( | ) |
◆ ~ConsoleHistory()
ConsoleHistory::~ConsoleHistory | ( | ) |
Member Function Documentation
◆ append()
void ConsoleHistory::append | ( | const QString & | inputLine | ) |
Referenced by Gui::PythonConsole::keyPressEvent(), and Gui::PythonConsole::printStatement().
◆ doScratch()
void ConsoleHistory::doScratch | ( | void | ) |
doScratch removes the tail of the history list, starting from the index marked lately.
References restart().
◆ first()
void ConsoleHistory::first | ( | ) |
◆ isEmpty()
bool ConsoleHistory::isEmpty | ( | ) | const |
Referenced by Gui::PythonConsole::contextMenuEvent(), and Gui::PythonConsole::onCopyHistory().
◆ markScratch()
void ConsoleHistory::markScratch | ( | void | ) |
markScratch stores the current end index of the history list.
Note: with simply remembering a start index, it does not work to nest scratch regions. However, just replace the index keeping by a stack - in case this is be a concern.
◆ more()
bool ConsoleHistory::more | ( | ) |
◆ next()
bool ConsoleHistory::next | ( | ) |
next switches the history pointer to the next item.
While searching the next item, the routine respects the search prefix set by prev().
- Returns
- true if the pointer was switched to a later item, false otherwise.
Referenced by Gui::PythonConsole::keyPressEvent().
◆ prev()
bool ConsoleHistory::prev | ( | const QString & | prefix = QString() | ) |
prev switches the history pointer to the previous item.
The optional parameter prefix allows to search the history selectively for commands that start with a certain character sequence.
- Parameters
-
prefix - prefix string for searching backwards in history, empty string by default
- Returns
- true if the pointer was switched to an earlier item, false otherwise.
Referenced by Gui::PythonConsole::keyPressEvent().
◆ restart()
void ConsoleHistory::restart | ( | ) |
restart resets the history access to the latest item.
Referenced by doScratch(), and Gui::PythonConsole::keyPressEvent().
◆ value()
const QString & ConsoleHistory::value | ( | ) | const |
◆ values()
const QStringList & ConsoleHistory::values | ( | ) | const |
The documentation for this class was generated from the following files:
- src/Gui/PythonConsole.h
- src/Gui/PythonConsole.cpp