Signals | Public Member Functions | Protected Member Functions | List of all members
pqPythonTextArea Class Reference

A python text editor widget. More...

#include <pqPythonTextArea.h>

Inherits QWidget.

Signals

void bufferErased ()
 Triggered when the current text buffer is erased. More...
 
void fileOpened (const QString &)
 Triggers after a file has been successfuly opened in the current buffer. More...
 
void fileSaved (const QString &)
 Triggers after a successful saves of the current buffer. More...
 
void contentChanged ()
 Emitted when the buffer content has been modified. More...
 

Public Member Functions

 pqPythonTextArea (QWidget *parent)
 Construct a pqPythonTextArea. More...
 
const QTextEdit * getTextEdit () const
 Returns the underlying text edit. More...
 
QTextEdit * getTextEdit ()
 Returns the underlying text edit. More...
 
const QUndoStack & getUndoStack () const
 
bool saveOnClose ()
 Returns true if the file has been saved. More...
 
bool openFile (const QString &filename, vtkTypeUInt32 location=0x10)
 Opens a file in the editor. More...
 
void setDefaultSaveDirectory (const QString &dir)
 Sets the default save directory. More...
 
void connectActions (pqPythonEditorActions &actions)
 Connects this widget to the set of actions. More...
 
void disconnectActions (pqPythonEditorActions &actions)
 Disconnect this widget from the set of actions. More...
 
const QString & getFilename () const
 Get filename associated with this buffer. More...
 
bool isEmpty () const
 Returns true if the buffer is empty. More...
 
bool isDirty () const
 Returns true if the buffer has been modified but not saved. More...
 
void setText (const QString &text)
 Override the current buffer content with the referenced string. More...
 
template<typename T >
void linkTo (T *)
 Link the current text area to an arbitrary QTextEdit like object. More...
 
void unlink ()
 Removes the linked QTextEdit like object. More...
 
bool isLinkedTo (const QObject *obj) const
 Returns true if the parameter is linked to this text area. More...
 
bool isLinked () const
 Returns true if this text area is linked. More...
 
QString getLinkedName () const
 Returns the linked text name. More...
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 Filter the KeyEvent CTRL+Z. More...
 

Detailed Description

A python text editor widget.

Displays an editable text area with syntax python highlighting and line numbering.

Definition at line 32 of file pqPythonTextArea.h.

Constructor & Destructor Documentation

◆ pqPythonTextArea()

pqPythonTextArea::pqPythonTextArea ( QWidget *  parent)
explicit

Construct a pqPythonTextArea.

Parameters
parentthe parent widget for the Qt ownership

Member Function Documentation

◆ getTextEdit() [1/2]

const QTextEdit* pqPythonTextArea::getTextEdit ( ) const
inline

Returns the underlying text edit.

Definition at line 46 of file pqPythonTextArea.h.

◆ getTextEdit() [2/2]

QTextEdit* pqPythonTextArea::getTextEdit ( )
inline

Returns the underlying text edit.

Definition at line 51 of file pqPythonTextArea.h.

◆ getUndoStack()

const QUndoStack& pqPythonTextArea::getUndoStack ( ) const
inline

Definition at line 53 of file pqPythonTextArea.h.

◆ saveOnClose()

bool pqPythonTextArea::saveOnClose ( )

Returns true if the file has been saved.

◆ openFile()

bool pqPythonTextArea::openFile ( const QString &  filename,
vtkTypeUInt32  location = 0x10 
)

Opens a file in the editor.

Triggers a saving wizard if the current buffer has not beed saved on the disk.

◆ setDefaultSaveDirectory()

void pqPythonTextArea::setDefaultSaveDirectory ( const QString &  dir)

Sets the default save directory.

Only used for the directory displayed when the save popup window is shown.

◆ connectActions()

void pqPythonTextArea::connectActions ( pqPythonEditorActions actions)

Connects this widget to the set of actions.

◆ disconnectActions()

void pqPythonTextArea::disconnectActions ( pqPythonEditorActions actions)

Disconnect this widget from the set of actions.

◆ getFilename()

const QString& pqPythonTextArea::getFilename ( ) const

Get filename associated with this buffer.

Returns an empty string if no file is associated.

◆ isEmpty()

bool pqPythonTextArea::isEmpty ( ) const

Returns true if the buffer is empty.

◆ isDirty()

bool pqPythonTextArea::isDirty ( ) const

Returns true if the buffer has been modified but not saved.

◆ setText()

void pqPythonTextArea::setText ( const QString &  text)

Override the current buffer content with the referenced string.

◆ linkTo()

template<typename T >
void pqPythonTextArea::linkTo ( T *  )
inline

Link the current text area to an arbitrary QTextEdit like object.

Definition at line 113 of file pqPythonTextArea.h.

◆ unlink()

void pqPythonTextArea::unlink ( )

Removes the linked QTextEdit like object.

◆ isLinkedTo()

bool pqPythonTextArea::isLinkedTo ( const QObject *  obj) const
inline

Returns true if the parameter is linked to this text area.

Definition at line 127 of file pqPythonTextArea.h.

◆ isLinked()

bool pqPythonTextArea::isLinked ( ) const
inline

Returns true if this text area is linked.

Definition at line 132 of file pqPythonTextArea.h.

◆ getLinkedName()

QString pqPythonTextArea::getLinkedName ( ) const
inline

Returns the linked text name.

Returns an empty string if nothing is linked

Definition at line 138 of file pqPythonTextArea.h.

◆ bufferErased

void pqPythonTextArea::bufferErased ( )
signal

Triggered when the current text buffer is erased.

◆ fileOpened

void pqPythonTextArea::fileOpened ( const QString &  )
signal

Triggers after a file has been successfuly opened in the current buffer.

◆ fileSaved

void pqPythonTextArea::fileSaved ( const QString &  )
signal

Triggers after a successful saves of the current buffer.

◆ contentChanged

void pqPythonTextArea::contentChanged ( )
signal

Emitted when the buffer content has been modified.

◆ eventFilter()

bool pqPythonTextArea::eventFilter ( QObject *  obj,
QEvent *  event 
)
overrideprotected

Filter the KeyEvent CTRL+Z.

We need to filter the QTextEdit KeyEvent otherwise our undo/redo actions are not triggered.


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