Workspace 6.21.5
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
TextViewer Class Reference

#include <Workspace/Presentation/Logging/textviewer.h>

Inherits QTextEdit.

Public Slots

void addText (const QString &text)
 
void disconnectFromCurrentWorkspace ()
 
void find (const QRegExp &pattern)
 
void loadText (const QString &fileName)
 
void setWordWrapping (bool checked)
 

Signals

void logCopy (bool b)
 
void selectOperation (QString idPath)
 

Public Member Functions

 TextViewer (QWidget *parent=nullptr)
 
 ~TextViewer () override
 
void captureLogStream ()
 
void captureLogStreamWithTimestamp ()
 
bool getWordWrapping () const
 
void stopLogStreamCapture ()
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) override
 
void dragEnterEvent (QDragEnterEvent *e) override
 
void dragLeaveEvent (QDragLeaveEvent *e) override
 
void dragMoveEvent (QDragMoveEvent *e) override
 
void focusInEvent (QFocusEvent *event) override
 
void focusOutEvent (QFocusEvent *event) override
 
void keyPressEvent (QKeyEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 
void resizeEvent (QResizeEvent *event) override
 

Detailed Description

Displays text information to a user, with the ability to filter or highlight text. Note that the viewer is assumed to be a logging widget and more importantly, that only one instance is typically in existence at any point in time. In some circumstances where a .ui file is loaded dynamically at run time by the Workspace framework, the private connectToWorkspace() slot will be called automatically and this is where the widget grabs the main log stream.

Constructor & Destructor Documentation

◆ TextViewer()

TextViewer ( QWidget *  parent = nullptr)
Parameters
parentThe parent widget.

◆ ~TextViewer()

~TextViewer ( )
override

Member Function Documentation

◆ addText

void addText ( const QString &  text)
slot
Parameters
textthe text that is being added to the display.

This is used for performance reasons. If you use this to update the display instead of calling setText() repeatedly, you will see a performance increase, as this will detect changes in the document (if any) and update those only.

◆ captureLogStream()

void captureLogStream ( )

Call this function when you want the text viewer to capture all text sent to the main log stream. The only situation where you would normally call this function is if your application has only one TextViewer and you want to redirect the log to it.

◆ captureLogStreamWithTimestamp()

void captureLogStreamWithTimestamp ( )

Call this function when you want the text viewer to capture all text sent to the main log stream with timestamp. The only situation where you would normally call this function is if your application has only one TextViewer and you want to redirect the log to it.

◆ contextMenuEvent()

void contextMenuEvent ( QContextMenuEvent *  event)
overrideprotected

This is called when a user right clicks on the QTextEdit widget.

◆ disconnectFromCurrentWorkspace

void disconnectFromCurrentWorkspace ( )
slot

Detaches from any previously connected workspaces (will stop logging from main log stream).

◆ dragEnterEvent()

void dragEnterEvent ( QDragEnterEvent *  e)
overrideprotected

◆ dragLeaveEvent()

void dragLeaveEvent ( QDragLeaveEvent *  e)
overrideprotected

◆ dragMoveEvent()

void dragMoveEvent ( QDragMoveEvent *  e)
overrideprotected

◆ find

void find ( const QRegExp &  pattern)
slot

◆ focusInEvent()

void focusInEvent ( QFocusEvent *  event)
overrideprotected

◆ focusOutEvent()

void focusOutEvent ( QFocusEvent *  event)
overrideprotected

◆ getWordWrapping()

bool getWordWrapping ( ) const
Returns
True if text will be wrapped in the viewer.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ loadText

void loadText ( const QString &  fileName)
slot
Parameters
fileNameThe name of the file to display. If a relative path is given, it is taken as relative to the current directory.

Sets the contents of the document to the contents of the specified file. If the file could not be opened for reading, the current contents of the widget are left unchanged.

◆ logCopy

void logCopy ( bool  b)
signal

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  e)
overrideprotected

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  event)
overrideprotected
Parameters
eventis sent from the widget on resize.

Called every time the widget is resized to update highlighting.

◆ selectOperation

void selectOperation ( QString  idPath)
signal

◆ setWordWrapping

void setWordWrapping ( bool  checked)
slot

◆ stopLogStreamCapture()

void stopLogStreamCapture ( )

Prevents text viewer from capturing any further text sent to the main log stream.