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 evaluate ()
 
void execute ()
 
void executeAll ()
 
QString exportASCII (const QString &file=QString::null)
 
void exportPDF (const QString &fileName)
 
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 updateIndentation ()
 

Signals

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

Public Member Functions

void commentSelection ()
 
void customEvent (QEvent *)
 Handle changing of scripting environment. More...
 
void enableShortcuts ()
 
bool error ()
 
bool find (const QString &searchString, QTextDocument::FindFlags flags, bool previous=false)
 
void findNext ()
 
void findPrevious ()
 
int lineNumber (int pos) const
 Map cursor positions to line numbers. More...
 
void redirectOutputTo (QTextEdit *)
 
void rehighlight ()
 
 ScriptEdit (ScriptingEnv *env, QWidget *parent=0, const char *name=0)
 
void setCompleter (QCompleter *c)
 
void setFileName (const QString &fn)
 
void uncommentSelection ()
 
 ~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. More...
 
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. More...
 
QString d_file_name
 
QTextBlockFormat d_fmt_default
 Format used for resetting success/failure markers. More...
 
SyntaxHighlighterd_highlighter
 
QTextEdit * d_output_widget
 
QTextDocument::FindFlags d_search_flags
 
QString d_search_string
 
QMenu * functionsMenu
 Submenu of context menu with mathematical functions. More...
 
ScriptmyScript
 
QTextCursor printCursor
 Cursor used for output of evaluation results and error messages. More...
 
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::ScriptEdit ( ScriptingEnv env,
QWidget *  parent = 0,
const char *  name = 0 
)

§ ~ScriptEdit()

ScriptEdit::~ScriptEdit ( )

References d_completer, and d_highlighter.

Member Function Documentation

§ activated

void ScriptEdit::activated ( ScriptEdit )
signal

§ clearErrorHighlighting()

void ScriptEdit::clearErrorHighlighting ( )
private

References d_fmt_default, and d_output_widget.

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

§ commentSelection()

void ScriptEdit::commentSelection ( )

§ contextMenuEvent()

void ScriptEdit::contextMenuEvent ( QContextMenuEvent *  e)
protectedvirtual

§ createParenthesisSelection()

void ScriptEdit::createParenthesisSelection ( int  pos)
private

§ customEvent()

void ScriptEdit::customEvent ( QEvent *  e)

§ dirPathChanged

void ScriptEdit::dirPathChanged ( const QString &  path)
signal

Referenced by importASCII(), and replace().

§ enableShortcuts()

void ScriptEdit::enableShortcuts ( )

§ error() [1/2]

bool ScriptEdit::error ( )
inline

§ error [2/2]

void ScriptEdit::error ( const QString &  ,
const QString &  ,
int   
)
signal

§ evaluate

void ScriptEdit::evaluate ( )
slot

§ execute

void ScriptEdit::execute ( )
slot

§ executeAll

void ScriptEdit::executeAll ( )
slot

§ exportASCII

QString ScriptEdit::exportASCII ( const QString &  file = QString::null)
slot

§ exportPDF

void ScriptEdit::exportPDF ( const QString &  fileName)
slot

Referenced by error(), and Note::exportPDF().

§ find()

bool ScriptEdit::find ( const QString &  searchString,
QTextDocument::FindFlags  flags,
bool  previous = false 
)

§ findNext()

void ScriptEdit::findNext ( )

§ findPrevious()

void ScriptEdit::findPrevious ( )

§ focusInEvent()

void ScriptEdit::focusInEvent ( QFocusEvent *  e)
protected

References activated(), and d_completer.

Referenced by replace().

§ highlightErrorLine()

void ScriptEdit::highlightErrorLine ( int  offset)
private

§ importASCII

QString ScriptEdit::importASCII ( const QString &  file = QString::null)
slot

§ insertCompletion

void ScriptEdit::insertCompletion ( const QString &  completion)
privateslot

§ insertErrorMsg

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().

§ insertFunction [1/2]

void ScriptEdit::insertFunction ( const QString &  fname)
slot

§ insertFunction [2/2]

void ScriptEdit::insertFunction ( QAction *  action)
slot

§ keyPressEvent()

void ScriptEdit::keyPressEvent ( QKeyEvent *  e)
protectedvirtual

References d_completer, textUnderCursor(), and updateIndentation().

Referenced by replace().

§ lineNumber()

int ScriptEdit::lineNumber ( int  pos) const

Map cursor positions to line numbers.

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

§ matchLeftParenthesis()

bool ScriptEdit::matchLeftParenthesis ( QTextBlock  currentBlock,
int  index,
int  numRightParentheses 
)
private

§ matchParentheses

void ScriptEdit::matchParentheses ( )
privateslot

§ matchRightParenthesis()

bool ScriptEdit::matchRightParenthesis ( QTextBlock  currentBlock,
int  index,
int  numLeftParentheses 
)
private

§ print [1/2]

void ScriptEdit::print ( )
slot

§ print [2/2]

void ScriptEdit::print ( QPrinter *  printer)
slot

§ redirectOutputTo()

void ScriptEdit::redirectOutputTo ( QTextEdit *  te)

References d_output_widget, and printCursor.

Referenced by error(), and ScriptWindow::redirectOutput().

§ rehighlight()

void ScriptEdit::rehighlight ( )

§ replace

void ScriptEdit::replace ( )
inlineslot

§ save

QString ScriptEdit::save ( )
slot

References d_file_name, and exportASCII().

Referenced by enableShortcuts(), error(), and ScriptEdit().

§ scriptPrint

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

References lineNumber(), and printCursor.

Referenced by customEvent(), ScriptEdit(), and setContext().

§ setCompleter()

void ScriptEdit::setCompleter ( QCompleter *  c)

§ setContext

void ScriptEdit::setContext ( QObject *  context)
inlineslot

§ setDirPath

void ScriptEdit::setDirPath ( const QString &  path)
slot

§ setFileName()

void ScriptEdit::setFileName ( const QString &  fn)

§ showFindDialog

void ScriptEdit::showFindDialog ( bool  replace = false)
slot

§ textUnderCursor()

QString ScriptEdit::textUnderCursor ( ) const
private

Referenced by keyPressEvent().

§ uncommentSelection()

void ScriptEdit::uncommentSelection ( )

§ updateIndentation

void ScriptEdit::updateIndentation ( )
slot

Referenced by keyPressEvent(), and setContext().

Member Data Documentation

§ actionEval

QAction * ScriptEdit::actionEval
private

§ actionExecute

QAction* ScriptEdit::actionExecute
private

Referenced by contextMenuEvent(), and ScriptEdit().

§ actionExecuteAll

QAction * ScriptEdit::actionExecuteAll
private

Referenced by contextMenuEvent(), and ScriptEdit().

§ actionExport

QAction * ScriptEdit::actionExport
private

Referenced by contextMenuEvent(), and ScriptEdit().

§ actionFind

QAction* ScriptEdit::actionFind
private

§ actionFindNext

QAction * ScriptEdit::actionFindNext
private

§ actionFindPrevious

QAction * ScriptEdit::actionFindPrevious
private

§ actionImport

QAction * ScriptEdit::actionImport
private

§ actionPrint

QAction * ScriptEdit::actionPrint
private

Referenced by contextMenuEvent(), and ScriptEdit().

§ actionReplace

QAction * ScriptEdit::actionReplace
private

§ actionSave

QAction * ScriptEdit::actionSave
private

§ d_completer

QCompleter* ScriptEdit::d_completer
private

§ d_err_message

QString ScriptEdit::d_err_message
private

§ d_error

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().

§ d_file_name

QString ScriptEdit::d_file_name
private

Referenced by save(), and setFileName().

§ d_fmt_default

QTextBlockFormat ScriptEdit::d_fmt_default
private

Format used for resetting success/failure markers.

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

§ d_highlighter

SyntaxHighlighter* ScriptEdit::d_highlighter
private

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

§ d_output_widget

QTextEdit* ScriptEdit::d_output_widget
private

§ d_search_flags

QTextDocument::FindFlags ScriptEdit::d_search_flags
private

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

§ d_search_string

QString ScriptEdit::d_search_string
private

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

§ functionsMenu

QMenu* ScriptEdit::functionsMenu
private

Submenu of context menu with mathematical functions.

Referenced by contextMenuEvent(), and ScriptEdit().

§ myScript

Script* ScriptEdit::myScript
private

§ printCursor

QTextCursor ScriptEdit::printCursor
private

Cursor used for output of evaluation results and error messages.

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

§ scriptsDirPath

QString ScriptEdit::scriptsDirPath
private

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