![]() |
XML Mill
1.0.0
A GUI based XML editor with a memory.
|
Specialist text edit class for displaying XML content in the XML Mill context. More...
#include <gcplaintextedit.h>
Public Slots | |
void | wrapText (bool wrap) |
Sets the necessary flags on the text edit to wrap or unwrap text as per "wrap". | |
Signals | |
void | selectedIndex (int index) |
Emitted whenever the selected index changes ("index" is the position of the text element/line relative to the first active element/beginning of the document, excluding comment blocks and other "non-active" XML). | |
void | commentOut (const QList< int > &, const QString &) |
Emitted whenever a selection has been commented out. | |
void | manualEditAccepted () |
Emitted whenever direct editing to the XML text occurred where the edit could represent any number of element additions/removals. | |
Public Member Functions | |
GCPlainTextEdit (QWidget *parent=0) | |
void | setContent (const QString &text) |
Use instead of "setPlainText" as it improves performance significantly (especially for larger documents). | |
void | findTextRelativeToDuplicates (const QString &text, int relativePos) |
Finds the "relativePos"'s occurrence of "text" within the active document (i.e if there are multiple occurrences of "text" within the document, we will find the "relativePos" occurrence measured from the start of the document). | |
void | clearAndReset () |
Resets the internal state of GCPlainTextEdit. | |
Protected Member Functions | |
void | keyPressEvent (QKeyEvent *e) |
Re-implemented from QPlainTextEdit. | |
void | mouseMoveEvent (QMouseEvent *e) |
Re-implemented from QPlainTextEdit. | |
void | mouseReleaseEvent (QMouseEvent *e) |
Re-implemented from QPlainTextEdit. | |
Private Slots | |
void | emitSelectedIndex () |
Checks if the text cursor is currently being manipulated programmatically and emits the "selectedIndex" signal if appropriate. | |
void | setCursorPositionChanged () |
Activated when the cursorPositionChanged signal is emitted. | |
void | showContextMenu (const QPoint &point) |
Shows the default context menu with the custom actions appended. | |
void | commentOutSelection () |
Comments out the selected text. | |
void | uncommentSelection () |
Uncomments a selection that's currently commented out and broadcasts the general change notification via. | |
void | deleteSelection () |
Permanently deletes the selection and broadcasts the general change notification via. | |
void | insertEmptyRow () |
Adds an empty row (useful when improving XML legibility). | |
void | deleteEmptyRow () |
Deletes an empty row (useful when improving XML legibility). | |
bool | confirmDomNotBroken (int undoCount) |
Check if the DOM was broken during a manual edit. | |
int | findIndexMatchingBlockNumber (QTextBlock block) |
Finds the position (index) of the text element/line represented by "block" relative to the first active element of the document, excluding comment blocks and other "non-active" XML. | |
Private Attributes | |
QBrush | m_savedBackground |
QBrush | m_savedForeground |
QAction * | m_comment |
QAction * | m_uncomment |
QAction * | m_deleteSelection |
QAction * | m_deleteEmptyRow |
QAction * | m_insertEmptyRow |
bool | m_cursorPositionChanging |
bool | m_cursorPositionChanged |
bool | m_mouseDragEntered |
bool | m_textEditClicked |
Specialist text edit class for displaying XML content in the XML Mill context.
Provides functionality with which to comment out or uncomment XML selections and keeps track of which XML nodes are currently under investigation (based on cursor positions).
Definition at line 43 of file gcplaintextedit.h.
void GCPlainTextEdit::clearAndReset | ( | ) |
Resets the internal state of GCPlainTextEdit.
Definition at line 178 of file gcplaintextedit.cpp.
void GCPlainTextEdit::commentOut | ( | const QList< int > & | , |
const QString & | |||
) | [signal] |
Emitted whenever a selection has been commented out.
The parameter list contains the indices corresponding to the items that should be removed from the tree widget.
void GCPlainTextEdit::commentOutSelection | ( | ) | [private, slot] |
Comments out the selected text.
If successful, the text is commented out and the "commentOut" signal is emitted.
Definition at line 224 of file gcplaintextedit.cpp.
bool GCPlainTextEdit::confirmDomNotBroken | ( | int | undoCount | ) | [private, slot] |
Check if the DOM was broken during a manual edit.
Definition at line 368 of file gcplaintextedit.cpp.
void GCPlainTextEdit::deleteEmptyRow | ( | ) | [private, slot] |
Deletes an empty row (useful when improving XML legibility).
Definition at line 348 of file gcplaintextedit.cpp.
void GCPlainTextEdit::deleteSelection | ( | ) | [private, slot] |
Permanently deletes the selection and broadcasts the general change notification via.
Definition at line 321 of file gcplaintextedit.cpp.
void GCPlainTextEdit::emitSelectedIndex | ( | ) | [private, slot] |
Checks if the text cursor is currently being manipulated programmatically and emits the "selectedIndex" signal if appropriate.
Definition at line 187 of file gcplaintextedit.cpp.
int GCPlainTextEdit::findIndexMatchingBlockNumber | ( | QTextBlock | block | ) | [private, slot] |
Finds the position (index) of the text element/line represented by "block" relative to the first active element of the document, excluding comment blocks and other "non-active" XML.
Definition at line 429 of file gcplaintextedit.cpp.
void GCPlainTextEdit::findTextRelativeToDuplicates | ( | const QString & | text, |
int | relativePos | ||
) |
Finds the "relativePos"'s occurrence of "text" within the active document (i.e if there are multiple occurrences of "text" within the document, we will find the "relativePos" occurrence measured from the start of the document).
Definition at line 126 of file gcplaintextedit.cpp.
void GCPlainTextEdit::insertEmptyRow | ( | ) | [private, slot] |
Adds an empty row (useful when improving XML legibility).
Definition at line 338 of file gcplaintextedit.cpp.
void GCPlainTextEdit::keyPressEvent | ( | QKeyEvent * | e | ) | [protected] |
Re-implemented from QPlainTextEdit.
Definition at line 491 of file gcplaintextedit.cpp.
void GCPlainTextEdit::manualEditAccepted | ( | ) | [signal] |
Emitted whenever direct editing to the XML text occurred where the edit could represent any number of element additions/removals.
void GCPlainTextEdit::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected] |
Re-implemented from QPlainTextEdit.
Definition at line 508 of file gcplaintextedit.cpp.
void GCPlainTextEdit::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected] |
Re-implemented from QPlainTextEdit.
Definition at line 516 of file gcplaintextedit.cpp.
void GCPlainTextEdit::selectedIndex | ( | int | index | ) | [signal] |
Emitted whenever the selected index changes ("index" is the position of the text element/line relative to the first active element/beginning of the document, excluding comment blocks and other "non-active" XML).
void GCPlainTextEdit::setContent | ( | const QString & | text | ) |
Use instead of "setPlainText" as it improves performance significantly (especially for larger documents).
Definition at line 111 of file gcplaintextedit.cpp.
void GCPlainTextEdit::setCursorPositionChanged | ( | ) | [private, slot] |
Activated when the cursorPositionChanged signal is emitted.
Definition at line 197 of file gcplaintextedit.cpp.
void GCPlainTextEdit::showContextMenu | ( | const QPoint & | point | ) | [private, slot] |
Shows the default context menu with the custom actions appended.
Definition at line 204 of file gcplaintextedit.cpp.
void GCPlainTextEdit::uncommentSelection | ( | ) | [private, slot] |
Uncomments a selection that's currently commented out and broadcasts the general change notification via.
Definition at line 279 of file gcplaintextedit.cpp.
void GCPlainTextEdit::wrapText | ( | bool | wrap | ) | [slot] |
Sets the necessary flags on the text edit to wrap or unwrap text as per "wrap".
Definition at line 477 of file gcplaintextedit.cpp.