#include <codeeditor.h>
|  | 
| void | insertText (const QString &text, TextBlock *parent, bool isEditable=false, const QColor &fgcolor=QColor("black"), const QColor &bgcolor=QColor("white"), UMLObject *umlobj=nullptr, const QString &displayName=QString(), int startLine=-1) | 
|  | 
| void | editTextBlock (TextBlock *tBlock, int para) | 
|  | 
| void | clearText () | 
|  | 
| QLabel * | componentLabel () | 
|  | 
| bool | paraIsNotSingleLine (int para) | 
|  | 
| void | expandSelectedParagraph (int where) | 
|  | 
| void | contractSelectedParagraph (int where) | 
|  | 
| void | updateTextBlockFromText (TextBlock *block) | 
|  | 
| void | initText (CodeDocument *doc) | 
|  | 
| void | init (CodeViewerDialog *parentDialog, CodeDocument *parentDoc) | 
|  | 
| void | changeTextBlockHighlighting (TextBlock *tb, bool selected) | 
|  | 
| void | setParagraphBackgroundColor (int position, const QColor &color) | 
|  | 
| bool | isParaEditable (int para) | 
|  | 
| bool | textBlockIsClickable (UMLObject *obj) | 
|  | 
| TextBlock * | findTextBlockAt (int characterPos) | 
|  | 
| void | clicked (int para, int pos) | 
|  | 
◆ CodeEditor() [1/2]
◆ CodeEditor() [2/2]
◆ ~CodeEditor()
      
        
          | CodeEditor::~CodeEditor | ( |  | ) |  | 
      
 
 
◆ appendText() [1/7]
◆ appendText() [2/7]
◆ appendText() [3/7]
  
  | 
        
          | void CodeEditor::appendText | ( | CodeComment * | comment, |  
          |  |  | TextBlock * | parent, |  
          |  |  | UMLObject * | umlObj = nullptr, |  
          |  |  | const QString & | componentName = QString() ) |  | protected | 
 
Appends a CodeComment to the widget. 
- Parameters
- 
  
    | comment | the code comment to add |  | parent | the parent text block |  | umlObj | the UML object |  | componentName | the name of the component |  
 
 
 
◆ appendText() [4/7]
Appends a CodeMethodBlock to the widget. 
- Parameters
- 
  
    | mb | the code method block to add |  
 
 
 
◆ appendText() [5/7]
◆ appendText() [6/7]
  
  | 
        
          | void CodeEditor::appendText | ( | TextBlock * | tb | ) |  |  | protected | 
 
Appends a TextBlock to the widget. 
- Parameters
- 
  
  
 
 
◆ appendText() [7/7]
◆ changeHighlighting
  
  | 
        
          | void CodeEditor::changeHighlighting | ( | int | signal | ) |  |  | slot | 
 
Colorizes/uncolorizes type for ALL paragraphs. 
 
 
◆ changeShowHidden
  
  | 
        
          | void CodeEditor::changeShowHidden | ( | int | signal | ) |  |  | slot | 
 
 
◆ changeTextBlockHighlighting()
  
  | 
        
          | void CodeEditor::changeTextBlockHighlighting | ( | TextBlock * | tBlock, |  
          |  |  | bool | selected ) |  | private | 
 
 
◆ clearText()
  
  | 
        
          | void CodeEditor::clearText | ( |  | ) |  |  | private | 
 
Clear the display of all text. 
 
 
◆ clicked()
  
  | 
        
          | void CodeEditor::clicked | ( | int | para, |  
          |  |  | int | pos ) |  | private | 
 
TODO: Used only for debugging right now. int para = tc.position(); –> is the character in the editor int pos = tc.blockNumber(); –> is the row in the editor 
 
 
◆ close()
  
  | 
        
          | bool CodeEditor::close | ( |  | ) |  |  | protected | 
 
Slot which closes this widget. Returns true if the widget was closed; otherwise returns false. Reimplemented from QWidget. 
- Returns
- state of close action 
 
 
◆ componentLabel()
  
  | 
        
          | QLabel * CodeEditor::componentLabel | ( |  | ) |  |  | private | 
 
Return the label on the dialog window. Some info can be shown. 
- Returns
- label widget of dialog 
 
 
◆ contentsMouseMoveEvent()
  
  | 
        
          | void CodeEditor::contentsMouseMoveEvent | ( | QMouseEvent * | e | ) |  |  | protected | 
 
Override the QT event so we can do appropriate things. 
 
 
◆ contextMenuEvent()
  
  | 
        
          | void CodeEditor::contextMenuEvent | ( | QContextMenuEvent * | event | ) |  |  | protected | 
 
Shows the context menu. Reimplemented from QWidget::contextMenuEvent(). 
 
 
◆ contractSelectedParagraph()
  
  | 
        
          | void CodeEditor::contractSelectedParagraph | ( | int | paraToRemove | ) |  |  | private | 
 
 
◆ createPopup()
  
  | 
        
          | QMenu * CodeEditor::createPopup | ( |  | ) |  |  | protected | 
 
Create the popup menu. 
- Returns
- the popup menu 
 
 
◆ editTextBlock()
  
  | 
        
          | void CodeEditor::editTextBlock | ( | TextBlock * | tBlock, |  
          |  |  | int | para ) |  | private | 
 
Allow us to edit, as appropriate, the parent UMLObject of the given text block. 
 
 
◆ expandSelectedParagraph()
  
  | 
        
          | void CodeEditor::expandSelectedParagraph | ( | int | priorPara | ) |  |  | private | 
 
 
◆ findTextBlockAt()
Find the text block in which the character position is located. 
- Parameters
- 
  
    | characterPos | the given character position |  
 
- Returns
- the text block in which the character position is found 
 
 
◆ init()
Initialization routine which is used in the constructors. 
- Parameters
- 
  
  
 
 
◆ initText()
◆ insertParagraph
  
  | 
        
          | void CodeEditor::insertParagraph | ( | const QString & | text, |  
          |  |  | int | para ) |  | slot | 
 
Insert a paragraph at a given position. 
- Parameters
- 
  
    | text | the paragraph text |  | para | the position where to add the text |  
 
 
 
◆ insertText()
  
  | 
        
          | void CodeEditor::insertText | ( | const QString & | text, |  
          |  |  | TextBlock * | parent, |  
          |  |  | bool | editable = false, |  
          |  |  | const QColor & | fgcolor = QColor("black"), |  
          |  |  | const QColor & | bgcolor = QColor("white"), |  
          |  |  | UMLObject * | umlobj = nullptr, |  
          |  |  | const QString & | displayName = QString(), |  
          |  |  | int | startLine = -1 ) |  | private | 
 
Main insert routine. Will append if startLine is not supplied or -1. 
- Parameters
- 
  
    | text | the text which has to be inserted |  | parent | the parent TextBlock |  | editable | flag if editable |  | fgcolor | foreground color |  | bgcolor | background color |  | umlobj | the UML object |  | displayName | the name which can be displayed |  | startLine | the starting line |  
 
 
 
◆ isNonBlank()
  
  | 
        
          | bool CodeEditor::isNonBlank | ( | const QString & | str | ) |  |  | staticprivate | 
 
Return whether or not the passed string is empty or contains nothing but whitespace. Note: The logic is the other way round. In this way we do not need all the "!" in if statements. 
 
 
◆ isParaEditable()
  
  | 
        
          | bool CodeEditor::isParaEditable | ( | int | para | ) |  |  | private | 
 
Checks if paragraph is editable or not. Method is used only in slotCursorPositionChanged. 
- Parameters
- 
  
    | para | the desired paragraph (character number) |  
 
- Returns
- flag if paragraph is editable or not 
 
 
◆ keyPressEvent()
  
  | 
        
          | void CodeEditor::keyPressEvent | ( | QKeyEvent * | e | ) |  |  | protected | 
 
Implemented so we may capture certain key presses, namely backspace and 'return' events. 
 
 
◆ loadFromDocument()
  
  | 
        
          | void CodeEditor::loadFromDocument | ( |  | ) |  |  | protected | 
 
(Re) Load the parent code document into the editor. 
 
 
◆ mouseDoubleClickEvent()
  
  | 
        
          | void CodeEditor::mouseDoubleClickEvent | ( | QMouseEvent * | e | ) |  |  | protected | 
 
Override the QT event so we can do appropriate things. 
 
 
◆ paraIsNotSingleLine()
  
  | 
        
          | bool CodeEditor::paraIsNotSingleLine | ( | int | para | ) |  |  | private | 
 
Check whether a block at a given position is on a single line. 
- Parameters
- 
  
    | para | the index of the block in the list |  
 
- Returns
- flag whether block is on a single line 
 
 
◆ rebuildView()
  
  | 
        
          | void CodeEditor::rebuildView | ( | int | startCursorPos | ) |  |  | protected | 
 
Rebuild our view of the document. Happens whenever we change some field/aspect of an underlying UML object used to create the view. If connections are right, then the UMLObject will send out the modified() signal which will trigger a call to re-generate the appropriate code within the code document. Our burden is to appropriately prepare the tool: we clear out ALL the textblocks in the KTextEdit widget and then re-show them after the dialog disappears. 
 
 
◆ removeParagraph
  
  | 
        
          | void CodeEditor::removeParagraph | ( | int | para | ) |  |  | slot | 
 
Remove a paragraph from a given position. 
- Parameters
- 
  
    | para | the position from where to remove the text |  
 
 
 
◆ setParagraphBackgroundColor()
  
  | 
        
          | void CodeEditor::setParagraphBackgroundColor | ( | int | position, |  
          |  |  | const QColor & | color ) |  | private | 
 
Set the background color at the cursor position. 
- Parameters
- 
  
    | position | the character position |  | color | the desired color |  
 
 
 
◆ slotChangeSelectedBlockCommentView
  
  | 
        
          | void CodeEditor::slotChangeSelectedBlockCommentView | ( |  | ) |  |  | protectedslot | 
 
Change the status of the comment writeOutText value to opposite of current value. 
 
 
◆ slotChangeSelectedBlockView
  
  | 
        
          | void CodeEditor::slotChangeSelectedBlockView | ( |  | ) |  |  | protectedslot | 
 
Slot to change the view of the selected block. This is called from a popup menu item. 
 
 
◆ slotCopyTextBlock
  
  | 
        
          | void CodeEditor::slotCopyTextBlock | ( |  | ) |  |  | protectedslot | 
 
Slot to copy a text block. 
 
 
◆ slotCursorPositionChanged
  
  | 
        
          | void CodeEditor::slotCursorPositionChanged | ( |  | ) |  |  | protectedslot | 
 
Slot for cursor position changed signal. 
 
 
◆ slotCutTextBlock
  
  | 
        
          | void CodeEditor::slotCutTextBlock | ( |  | ) |  |  | protectedslot | 
 
Slot to cut a text block. 
 
 
◆ slotInsertCodeBlockAfterSelected
  
  | 
        
          | void CodeEditor::slotInsertCodeBlockAfterSelected | ( |  | ) |  |  | protectedslot | 
 
Slot to insert a code block after the selection. 
 
 
◆ slotInsertCodeBlockBeforeSelected
  
  | 
        
          | void CodeEditor::slotInsertCodeBlockBeforeSelected | ( |  | ) |  |  | protectedslot | 
 
Slot to insert a code block before the selection. 
 
 
◆ slotPasteTextBlock
  
  | 
        
          | void CodeEditor::slotPasteTextBlock | ( |  | ) |  |  | protectedslot | 
 
Slot to paste a text block. 
 
 
◆ slotRedrawText
  
  | 
        
          | void CodeEditor::slotRedrawText | ( |  | ) |  |  | slot | 
 
 
◆ state()
Return code viewer state. 
- Returns
- state of the code viewer 
 
 
◆ textBlockIsClickable()
  
  | 
        
          | bool CodeEditor::textBlockIsClickable | ( | UMLObject * | obj | ) |  |  | private | 
 
All umlobjects which may have pop-up boxes should return true here. Yes, a CRAPPY way of doing this. Im not proud. =b.t. 
 
 
◆ updateTextBlockFromText()
  
  | 
        
          | void CodeEditor::updateTextBlockFromText | ( | TextBlock * | block | ) |  |  | private | 
 
Read the text under the cursor and add it to the text block. 
- Parameters
- 
  
    | block | the text block to which the text is added |  
 
 
 
◆ m_backspacePressed
  
  | 
        
          | bool CodeEditor::m_backspacePressed |  | private | 
 
 
◆ m_isHighlighted
  
  | 
        
          | bool CodeEditor::m_isHighlighted |  | private | 
 
 
◆ m_lastPara
  
  | 
        
          | int CodeEditor::m_lastPara |  | private | 
 
 
◆ m_lastPos
  
  | 
        
          | int CodeEditor::m_lastPos |  | private | 
 
 
◆ m_lastTextBlockToBeEdited
  
  | 
        
          | TextBlock* CodeEditor::m_lastTextBlockToBeEdited |  | private | 
 
 
◆ m_newLinePressed
  
  | 
        
          | bool CodeEditor::m_newLinePressed |  | private | 
 
 
◆ m_parentDialog
◆ m_parentDoc
◆ m_parentDocName
  
  | 
        
          | QString CodeEditor::m_parentDocName |  | private | 
 
 
◆ m_selectedTextBlock
◆ m_showHiddenBlocks
  
  | 
        
          | bool CodeEditor::m_showHiddenBlocks |  | private | 
 
 
◆ m_tbInfoMap
◆ m_textBlockList
◆ m_textBlockToPaste
The documentation for this class was generated from the following files: