OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::TextEditor Class Reference

#include "TextEditor.h"

Inheritance diagram for ot::TextEditor:
ot::PlainTextEdit ot::QWidgetInterface

Public Slots

void slotSaveRequested (void)
 
- Public Slots inherited from ot::PlainTextEdit
void slotTextChanged (void)
 

Signals

void saveRequested (void)
 

Public Member Functions

 TextEditor (QWidget *_parent=(QWidget *) nullptr)
 
virtual ~TextEditor ()
 
virtual void setupFromConfig (const TextEditorCfg &_config, bool _isUpdate)
 Setup the TextEditor.
 
int lineNumberAreaWidth (void) const
 
void lineNumberAreaPaintEvent (QPaintEvent *_event)
 
void setContentChanged (void)
 
void setContentSaved (void)
 
bool getContentChanged (void) const
 
void setCode (const QString &_text)
 
void setCode (const QStringList &_lines)
 
bool saveToFile (const QString &_fileName)
 
QStringList code (void) const
 
void storeSyntaxHighlighter (SyntaxHighlighter *_highlighter)
 Stores the syntax highlighter. An existing syntax highlighter will be replaced. The TextEditor takes ownership of the highlighter.
 
SyntaxHighlightergetSyntaxHighlighter (void)
 Returns the current syntax highlighter. The TextEditor keeps ownership of the highlighter.
 
SyntaxHighlightertakeSyntaxHighlighter (void)
 Returns the current syntax highlighter and sets it to 0 internally. The caller takes ownership of the highlighter.
 
void setTabSpaces (int _spaces)
 
int tabSpaces (void) const
 
void setNewLineWithSamePrefix (bool _enabled)
 
bool newLineWithSamePrefix (void) const
 
void setDuplicateLineShortcutEnabled (bool _enabled)
 
bool isDuplicateLineShortcutEnabled (void) const
 
void setEnableSameTextHighlighting (bool _enabled)
 
bool isSameTextHighlightingEnabled (void) const
 
- Public Member Functions inherited from ot::PlainTextEdit
 PlainTextEdit (QWidget *_parent=(QWidget *) nullptr)
 
virtual ~PlainTextEdit ()
 
virtual QWidget * getQWidget (void) override
 Returns a pointer to the root widget of this object.
 
virtual const QWidget * getQWidget (void) const override
 
void setAutoScrollToBottomEnabled (bool _enabled)
 
bool isAutoScrollToBottomEnabled (void) const
 
void scrollToBottom (void)
 
- Public Member Functions inherited from ot::QWidgetInterface
 QWidgetInterface ()
 
virtual ~QWidgetInterface ()
 
void setOTWidgetFlags (const WidgetFlags &_flags)
 
const WidgetFlagsotWidgetFlags (void) const
 

Protected Member Functions

virtual void keyPressEvent (QKeyEvent *_event) override
 
virtual void resizeEvent (QResizeEvent *_event) override
 
virtual void wheelEvent (QWheelEvent *_event) override
 
- Protected Member Functions inherited from ot::QWidgetInterface
virtual void otWidgetFlagsChanged (const WidgetFlags &_flags)
 

Friends

class TextEditorSearchPopup
 

Constructor & Destructor Documentation

◆ TextEditor()

ot::TextEditor::TextEditor ( QWidget * _parent = (QWidget*)nullptr)

◆ ~TextEditor()

ot::TextEditor::~TextEditor ( )
virtual

Member Function Documentation

◆ code()

QStringList ot::TextEditor::code ( void ) const

◆ getContentChanged()

bool ot::TextEditor::getContentChanged ( void ) const

◆ getSyntaxHighlighter()

SyntaxHighlighter * ot::TextEditor::getSyntaxHighlighter ( void )
inline

Returns the current syntax highlighter. The TextEditor keeps ownership of the highlighter.

◆ isDuplicateLineShortcutEnabled()

bool ot::TextEditor::isDuplicateLineShortcutEnabled ( void ) const
inline

◆ isSameTextHighlightingEnabled()

bool ot::TextEditor::isSameTextHighlightingEnabled ( void ) const
inline

◆ keyPressEvent()

void ot::TextEditor::keyPressEvent ( QKeyEvent * _event)
overrideprotectedvirtual

◆ lineNumberAreaPaintEvent()

void ot::TextEditor::lineNumberAreaPaintEvent ( QPaintEvent * _event)

◆ lineNumberAreaWidth()

int ot::TextEditor::lineNumberAreaWidth ( void ) const

◆ newLineWithSamePrefix()

bool ot::TextEditor::newLineWithSamePrefix ( void ) const
inline

◆ resizeEvent()

void ot::TextEditor::resizeEvent ( QResizeEvent * _event)
overrideprotectedvirtual

◆ saveRequested

void ot::TextEditor::saveRequested ( void )
signal

◆ saveToFile()

bool ot::TextEditor::saveToFile ( const QString & _fileName)

◆ setCode() [1/2]

void ot::TextEditor::setCode ( const QString & _text)

◆ setCode() [2/2]

void ot::TextEditor::setCode ( const QStringList & _lines)

◆ setContentChanged()

void ot::TextEditor::setContentChanged ( void )

◆ setContentSaved()

void ot::TextEditor::setContentSaved ( void )

◆ setDuplicateLineShortcutEnabled()

void ot::TextEditor::setDuplicateLineShortcutEnabled ( bool _enabled)
inline

◆ setEnableSameTextHighlighting()

void ot::TextEditor::setEnableSameTextHighlighting ( bool _enabled)
inline

◆ setNewLineWithSamePrefix()

void ot::TextEditor::setNewLineWithSamePrefix ( bool _enabled)
inline

◆ setTabSpaces()

void ot::TextEditor::setTabSpaces ( int _spaces)
inline

◆ setupFromConfig()

void ot::TextEditor::setupFromConfig ( const TextEditorCfg & _config,
bool _isUpdate )
virtual

Setup the TextEditor.

Parameters
_configThe config.
_isUpdateIf true the text, name and title won't be set.

◆ slotSaveRequested

void ot::TextEditor::slotSaveRequested ( void )
slot

◆ storeSyntaxHighlighter()

void ot::TextEditor::storeSyntaxHighlighter ( SyntaxHighlighter * _highlighter)

Stores the syntax highlighter. An existing syntax highlighter will be replaced. The TextEditor takes ownership of the highlighter.

◆ tabSpaces()

int ot::TextEditor::tabSpaces ( void ) const
inline

◆ takeSyntaxHighlighter()

ot::SyntaxHighlighter * ot::TextEditor::takeSyntaxHighlighter ( void )

Returns the current syntax highlighter and sets it to 0 internally. The caller takes ownership of the highlighter.

◆ wheelEvent()

void ot::TextEditor::wheelEvent ( QWheelEvent * _event)
overrideprotectedvirtual

Friends And Related Symbol Documentation

◆ TextEditorSearchPopup

friend class TextEditorSearchPopup
friend

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