Workspace 7.0.2
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
JSEdit Class Reference

#include <Workspace/Widgets/jsedit.h>

Inherits QPlainTextEdit.

Public Types

enum  ColorComponent {
  Background , Normal , Comment , Number ,
  String , Operator , Identifier , Keyword ,
  BuiltIn , Sidebar , LineNumber , Cursor ,
  Marker , BracketMatch , BracketError , FoldIndicator ,
  Custom = 110
}
 

Public Slots

void fold (int line)
 
void mark (const QString &str, Qt::CaseSensitivity sens=Qt::CaseInsensitive)
 
void setBracketsMatchingEnabled (bool enable)
 
void setCodeFoldingEnabled (bool enable)
 
void setLineNumbersVisible (bool visible)
 
void setTextWrapEnabled (bool enable)
 
void toggleFold (int line)
 
void unfold (int line)
 
void updateSidebar ()
 

Signals

void focusOut ()
 

Public Member Functions

 JSEdit (QWidget *parent=nullptr)
 
 ~JSEdit () override
 
void focusOutEvent (QFocusEvent *event) override
 
bool getReplaceTabsWithSpaces () const
 
bool isBracketsMatchingEnabled () const
 
bool isCodeFoldingEnabled () const
 
bool isFoldable (int line) const
 
bool isFolded (int line) const
 
bool isLineNumbersVisible () const
 
bool isTextWrapEnabled () const
 
QStringList keywords () const
 
void replaceTabsWithSpaces (bool bEnable, int numSpaces=4)
 
void setColor (ColorComponent component, const QColor &color)
 
void setCustomKeywords (const QStringList &keywords)
 
void setKeywords (const QStringList &keywords)
 

Protected Member Functions

void keyPressEvent (QKeyEvent *e) override
 
void resizeEvent (QResizeEvent *e) override
 
void wheelEvent (QWheelEvent *e) override
 

Properties

bool bracketsMatchingEnabled
 
bool codeFoldingEnabled
 
bool lineNumbersVisible
 
bool textWrapEnabled
 

Member Enumeration Documentation

◆ ColorComponent

Enumerator
Background 
Normal 
Comment 
Number 
String 
Operator 
Identifier 
Keyword 
BuiltIn 
Sidebar 
LineNumber 
Cursor 
Marker 
BracketMatch 
BracketError 
FoldIndicator 
Custom 

Constructor & Destructor Documentation

◆ JSEdit()

JSEdit ( QWidget *  parent = nullptr)

◆ ~JSEdit()

~JSEdit ( )
override

Member Function Documentation

◆ focusOut

void focusOut ( )
signal

◆ focusOutEvent()

void focusOutEvent ( QFocusEvent *  event)
override

◆ fold

void fold ( int  line)
slot

◆ getReplaceTabsWithSpaces()

bool getReplaceTabsWithSpaces ( ) const

Returns true if the widget is configured to replace tabs with spaces, or false otherwise.

◆ isBracketsMatchingEnabled()

bool isBracketsMatchingEnabled ( ) const

◆ isCodeFoldingEnabled()

bool isCodeFoldingEnabled ( ) const

◆ isFoldable()

bool isFoldable ( int  line) const

◆ isFolded()

bool isFolded ( int  line) const

◆ isLineNumbersVisible()

bool isLineNumbersVisible ( ) const

◆ isTextWrapEnabled()

bool isTextWrapEnabled ( ) const

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ keywords()

QStringList keywords ( ) const

◆ mark

void mark ( const QString &  str,
Qt::CaseSensitivity  sens = Qt::CaseInsensitive 
)
slot

◆ replaceTabsWithSpaces()

void replaceTabsWithSpaces ( bool  bEnable,
int  numSpaces = 4 
)

When enabled, tabs in JsEdit will be replaced with spaces. The number of spaces is 4 by default, but can be over-ridden by passing an appropriate value for parameter numSpaces.

Parameters
bEnableEnables tab / space replacement functionality on keypress.
numSpacesThe number of spaces to use in place of a tab.

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  e)
overrideprotected

◆ setBracketsMatchingEnabled

void setBracketsMatchingEnabled ( bool  enable)
slot

◆ setCodeFoldingEnabled

void setCodeFoldingEnabled ( bool  enable)
slot

◆ setColor()

void setColor ( ColorComponent  component,
const QColor &  color 
)

◆ setCustomKeywords()

void setCustomKeywords ( const QStringList keywords)

◆ setKeywords()

void setKeywords ( const QStringList keywords)

◆ setLineNumbersVisible

void setLineNumbersVisible ( bool  visible)
slot

◆ setTextWrapEnabled

void setTextWrapEnabled ( bool  enable)
slot

◆ toggleFold

void toggleFold ( int  line)
slot

◆ unfold

void unfold ( int  line)
slot

◆ updateSidebar

void updateSidebar ( )
slot

◆ wheelEvent()

void wheelEvent ( QWheelEvent *  e)
overrideprotected

Property Documentation

◆ bracketsMatchingEnabled

bool bracketsMatchingEnabled
readwrite

◆ codeFoldingEnabled

bool codeFoldingEnabled
readwrite

◆ lineNumbersVisible

bool lineNumbersVisible
readwrite

◆ textWrapEnabled

bool textWrapEnabled
readwrite