QtiPlot  0.9.8.2
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
ScriptEdit Class Reference

Editor widget with support for evaluating expressions and executing code. More...

#include <ScriptEdit.h>

Inheritance diagram for ScriptEdit:
scripted

Public Slots

void commentSelection ()
void evaluate ()
void execute ()
void executeAll ()
QString exportASCII (const QString &file=QString::null)
void exportPDF (const QString &fileName)
bool find (const QString &searchString, QTextDocument::FindFlags flags, bool previous=false)
void findNext ()
void findPrevious ()
QString importASCII (const QString &file=QString::null)
void insertFunction (const QString &)
void insertFunction (QAction *action)
void print ()
void print (QPrinter *)
void replace ()
QString save ()
void scriptPrint (const QString &)
void setContext (QObject *context)
void setDirPath (const QString &path)
void showFindDialog (bool replace=false)
void uncommentSelection ()
void updateIndentation ()

Signals

void activated (ScriptEdit *)
void dirPathChanged (const QString &path)
void error (const QString &, const QString &, int)

Public Member Functions

void customEvent (QEvent *)
 Handle changing of scripting environment.
void enableShortcuts ()
bool error ()
int lineNumber (int pos) const
 Map cursor positions to line numbers.
void redirectOutputTo (QTextEdit *)
void rehighlight ()
 ScriptEdit (ScriptingEnv *env, QWidget *parent=0, const char *name=0)
void setCompleter (QCompleter *c)
void setFileName (const QString &fn)
 ~ScriptEdit ()
- Public Member Functions inherited from scripted
 scripted (ScriptingEnv *env)
void scriptingChangeEvent (ScriptingChangeEvent *)
ScriptingEnvscriptingEnv ()
 ~scripted ()

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *e)
void focusInEvent (QFocusEvent *e)
virtual void keyPressEvent (QKeyEvent *e)

Private Slots

void insertCompletion (const QString &completion)
void insertErrorMsg (const QString &message)
 Insert an error message from the scripting system at printCursor.
void matchParentheses ()

Private Member Functions

void clearErrorHighlighting ()
void createParenthesisSelection (int pos)
void highlightErrorLine (int offset)
bool matchLeftParenthesis (QTextBlock currentBlock, int index, int numRightParentheses)
bool matchRightParenthesis (QTextBlock currentBlock, int index, int numLeftParentheses)
QString textUnderCursor () const

Private Attributes

QAction * actionEval
QAction * actionExecute
QAction * actionExecuteAll
QAction * actionExport
QAction * actionFind
QAction * actionFindNext
QAction * actionFindPrevious
QAction * actionImport
QAction * actionPrint
QAction * actionReplace
QAction * actionSave
QCompleter * d_completer
QString d_err_message
bool d_error
 True if we are inside evaluate(), execute() or executeAll() there were errors.
QString d_file_name
QTextBlockFormat d_fmt_default
 Format used for resetting success/failure markers.
SyntaxHighlighterd_highlighter
QTextEdit * d_output_widget
QTextDocument::FindFlags d_search_flags
QString d_search_string
QMenu * functionsMenu
 Submenu of context menu with mathematical functions.
ScriptmyScript
QTextCursor printCursor
 Cursor used for output of evaluation results and error messages.
QString scriptsDirPath

Additional Inherited Members

- Protected Attributes inherited from scripted
ScriptingEnvscriptEnv

Detailed Description

Editor widget with support for evaluating expressions and executing code.

Future Plans

Constructor & Destructor Documentation

ScriptEdit::ScriptEdit ( ScriptingEnv env,
QWidget *  parent = 0,
const char *  name = 0 
)
ScriptEdit::~ScriptEdit ( )

References d_completer, and d_highlighter.

Member Function Documentation

void ScriptEdit::activated ( ScriptEdit )
signal
void ScriptEdit::clearErrorHighlighting ( )
private

References d_fmt_default, and d_output_widget.

Referenced by evaluate(), execute(), and executeAll().

void ScriptEdit::commentSelection ( )
slot
void ScriptEdit::contextMenuEvent ( QContextMenuEvent *  e)
protectedvirtual
void ScriptEdit::createParenthesisSelection ( int  pos)
private
void ScriptEdit::customEvent ( QEvent *  e)
void ScriptEdit::dirPathChanged ( const QString &  path)
signal

Referenced by importASCII().

void ScriptEdit::enableShortcuts ( )
bool ScriptEdit::error ( )
inline
void ScriptEdit::error ( const QString &  ,
const QString &  ,
int   
)
signal
void ScriptEdit::evaluate ( )
slot
void ScriptEdit::execute ( )
slot
void ScriptEdit::executeAll ( )
slot
QString ScriptEdit::exportASCII ( const QString &  file = QString::null)
slot
void ScriptEdit::exportPDF ( const QString &  fileName)
slot

Referenced by Note::exportPDF().

bool ScriptEdit::find ( const QString &  searchString,
QTextDocument::FindFlags  flags,
bool  previous = false 
)
slot
void ScriptEdit::findNext ( )
slot
void ScriptEdit::findPrevious ( )
slot
void ScriptEdit::focusInEvent ( QFocusEvent *  e)
protected

References activated(), and d_completer.

void ScriptEdit::highlightErrorLine ( int  offset)
private
QString ScriptEdit::importASCII ( const QString &  file = QString::null)
slot
void ScriptEdit::insertCompletion ( const QString &  completion)
privateslot
void ScriptEdit::insertErrorMsg ( const QString &  message)
privateslot

Insert an error message from the scripting system at printCursor.

After insertion, the text cursor will have the error message selected, allowing the user to delete it and fix the error.

References ScriptingEnv::application(), d_err_message, d_error, printCursor, and scripted::scriptEnv.

Referenced by customEvent(), and ScriptEdit().

void ScriptEdit::insertFunction ( const QString &  fname)
slot
void ScriptEdit::insertFunction ( QAction *  action)
slot
void ScriptEdit::keyPressEvent ( QKeyEvent *  e)
protectedvirtual
int ScriptEdit::lineNumber ( int  pos) const

Map cursor positions to line numbers.

Referenced by evaluate(), execute(), highlightErrorLine(), and scriptPrint().

bool ScriptEdit::matchLeftParenthesis ( QTextBlock  currentBlock,
int  index,
int  numRightParentheses 
)
private
void ScriptEdit::matchParentheses ( )
privateslot
bool ScriptEdit::matchRightParenthesis ( QTextBlock  currentBlock,
int  index,
int  numLeftParentheses 
)
private
void ScriptEdit::print ( )
slot
void ScriptEdit::print ( QPrinter *  printer)
slot
void ScriptEdit::redirectOutputTo ( QTextEdit *  te)
void ScriptEdit::rehighlight ( )
void ScriptEdit::replace ( )
inlineslot

References showFindDialog().

Referenced by enableShortcuts(), and ScriptEdit().

QString ScriptEdit::save ( )
slot

References d_file_name, and exportASCII().

Referenced by enableShortcuts(), and ScriptEdit().

void ScriptEdit::scriptPrint ( const QString &  text)
slot

References lineNumber(), and printCursor.

Referenced by customEvent(), and ScriptEdit().

void ScriptEdit::setCompleter ( QCompleter *  c)
void ScriptEdit::setContext ( QObject *  context)
inlineslot
void ScriptEdit::setDirPath ( const QString &  path)
slot
void ScriptEdit::setFileName ( const QString &  fn)
void ScriptEdit::showFindDialog ( bool  replace = false)
slot
QString ScriptEdit::textUnderCursor ( ) const
private

Referenced by keyPressEvent().

void ScriptEdit::uncommentSelection ( )
slot
void ScriptEdit::updateIndentation ( )
slot

Referenced by keyPressEvent().

Member Data Documentation

QAction * ScriptEdit::actionEval
private
QAction* ScriptEdit::actionExecute
private

Referenced by contextMenuEvent(), and ScriptEdit().

QAction * ScriptEdit::actionExecuteAll
private

Referenced by contextMenuEvent(), and ScriptEdit().

QAction * ScriptEdit::actionExport
private

Referenced by contextMenuEvent(), and ScriptEdit().

QAction* ScriptEdit::actionFind
private
QAction * ScriptEdit::actionFindNext
private
QAction * ScriptEdit::actionFindPrevious
private
QAction * ScriptEdit::actionImport
private
QAction * ScriptEdit::actionPrint
private

Referenced by contextMenuEvent(), and ScriptEdit().

QAction * ScriptEdit::actionReplace
private
QAction * ScriptEdit::actionSave
private
QCompleter* ScriptEdit::d_completer
private
QString ScriptEdit::d_err_message
private
bool ScriptEdit::d_error
private

True if we are inside evaluate(), execute() or executeAll() there were errors.

Referenced by error(), evaluate(), execute(), executeAll(), highlightErrorLine(), and insertErrorMsg().

QString ScriptEdit::d_file_name
private

Referenced by save(), and setFileName().

QTextBlockFormat ScriptEdit::d_fmt_default
private

Format used for resetting success/failure markers.

Referenced by clearErrorHighlighting(), evaluate(), and ScriptEdit().

SyntaxHighlighter* ScriptEdit::d_highlighter
private

Referenced by rehighlight(), and ~ScriptEdit().

QTextEdit* ScriptEdit::d_output_widget
private
QTextDocument::FindFlags ScriptEdit::d_search_flags
private

Referenced by find(), findNext(), and findPrevious().

QString ScriptEdit::d_search_string
private

Referenced by find(), findNext(), and findPrevious().

QMenu* ScriptEdit::functionsMenu
private

Submenu of context menu with mathematical functions.

Referenced by contextMenuEvent(), and ScriptEdit().

Script* ScriptEdit::myScript
private
QTextCursor ScriptEdit::printCursor
private

Cursor used for output of evaluation results and error messages.

Referenced by evaluate(), execute(), insertErrorMsg(), redirectOutputTo(), ScriptEdit(), and scriptPrint().

QString ScriptEdit::scriptsDirPath
private

The documentation for this class was generated from the following files: