[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
KLFLatexEdit Class Reference

A text edit field that edits latex code. More...

#include <klflatexedit.h>

Inheritance diagram for KLFLatexEdit:
Inheritance graph
[legend]
Collaboration diagram for KLFLatexEdit:
Collaboration graph
[legend]

Public Slots

void setLatex (const QString &latex)
 
void clearLatex ()
 
void setHeightHintLines (int lines)
 
void insertDelimiter (const QString &delim, int charsBack=1)
 

Signals

void insertContextMenuActions (const QPoint &pos, QList< QAction * > *actionList)
 

Public Member Functions

 KLFLatexEdit (QWidget *mainwin)
 
virtual ~KLFLatexEdit ()
 
KLFLatexSyntaxHighlightersyntaxHighlighter ()
 
void setMainWinDataOpener (KLFMainWin *mainwin)
 
int heightHintLines () const
 
virtual QSize sizeHint () const
 
- Public Member Functions inherited from QTextEdit
 TextInteractionFlags
 
 WrapMode
 
 QTextEdit (QWidget *parent=0)
 
 QTextEdit (const QString &text, QWidget *parent=0)
 
 Alignment QTextEdit::alignment()
 
 anchorAt (const QPoint &pos)
 
 append (const QString &text)
 
 canInsertFromMimeData (const QMimeData *source)
 
 canPaste ()
 
 clear ()
 
 contextMenuEvent (QContextMenuEvent *event)
 
 copy ()
 
 copyAvailable (bool yes)
 
 createMimeDataFromSelection ()
 
 createStandardContextMenu ()
 
 currentCharFormat ()
 
 currentCharFormatChanged (const QTextCharFormat &f)
 
 currentFont ()
 
 cursorForPosition (const QPoint &pos)
 
 cursorPositionChanged ()
 
 cursorRect (const QTextCursor &cursor)
 
 cursorRect ()
 
 cut ()
 
 document ()
 
 ensureCursorVisible ()
 
 extraSelections ()
 
 find (const QString &exp, QTextDocument::FindFlags options=0)
 
 fontFamily ()
 
 fontItalic ()
 
 fontPointSize ()
 
 fontUnderline ()
 
 fontWeight ()
 
 insertFromMimeData (const QMimeData *source)
 
 insertHtml (const QString &text)
 
 insertPlainText (const QString &text)
 
 loadResource (int type, const QUrl &name)
 
 mergeCurrentCharFormat (const QTextCharFormat &modifier)
 
 moveCursor (QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
 
 paste ()
 
 print (QPrinter *printer)
 
 redo ()
 
 redoAvailable (bool available)
 
 scrollToAnchor (const QString &name)
 
 selectAll ()
 
 selectionChanged ()
 
 setAlignment (Qt::Alignment a)
 
 setCurrentCharFormat (const QTextCharFormat &format)
 
 setCurrentFont (const QFont &f)
 
 setDocument (QTextDocument *document)
 
 setExtraSelections (const QList< ExtraSelection > &selections)
 
 setFontFamily (const QString &fontFamily)
 
 setFontItalic (bool italic)
 
 setFontPointSize (qreal s)
 
 setFontUnderline (bool underline)
 
 setFontWeight (int weight)
 
 setText (const QString &text)
 
 setTextColor (const QColor &c)
 
 setTextCursor (const QTextCursor &cursor)
 
 textChanged ()
 
 textColor ()
 
 textCursor ()
 
 undo ()
 
 undoAvailable (bool available)
 
 zoomIn (int range=1)
 
 zoomOut (int range=1)
 
 QTextEdit (QWidget *parent, const char *name)
 
 bold ()
 
 color ()
 
 currentColorChanged (const QColor &color)
 
 currentFontChanged (const QFont &font)
 
 doKeyboardAction (KeyboardAction action)
 
 family ()
 
 find (const QString &exp, bool cs, bool wo)
 
 hasSelectedText ()
 
 insert (const QString &text)
 
 isModified ()
 
 isRedoAvailable ()
 
 isUndoAvailable ()
 
 italic ()
 
 moveCursor (CursorAction action, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
 
 moveCursor (CursorAction action, bool select)
 
 pointSize ()
 
 redo ()
 
 selectedText ()
 
 setBold (bool b)
 
 setColor (const QColor &color)
 
 setFamily (const QString &family)
 
 setItalic (bool i)
 
 setModified (bool m=true)
 
 setPointSize (int size)
 
 setTextFormat (Qt::TextFormat f)
 
 setUnderline (bool b)
 
 sync ()
 
 text ()
 
 TextFormat QTextEdit::textFormat()
 
 underline ()
 
 undo ()
 

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *event)
 
virtual bool canInsertFromMimeData (const QMimeData *source) const
 
virtual void insertFromMimeData (const QMimeData *source)
 

Detailed Description

A text edit field that edits latex code.

Implementation of a QTextEdit to type latex code.

Definition at line 51 of file klflatexedit.h.

Constructor & Destructor Documentation

KLFLatexEdit::KLFLatexEdit ( QWidget mainwin)

Definition at line 39 of file klflatexedit.cpp.

References QTextEdit::cursorPositionChanged().

KLFLatexEdit::~KLFLatexEdit ( )
virtual

Definition at line 50 of file klflatexedit.cpp.

Member Function Documentation

bool KLFLatexEdit::canInsertFromMimeData ( const QMimeData source) const
protectedvirtual
void KLFLatexEdit::clearLatex ( )
slot

Definition at line 54 of file klflatexedit.cpp.

References KLFLatexSyntaxHighlighter::resetEditing(), and setLatex().

void KLFLatexEdit::contextMenuEvent ( QContextMenuEvent event)
protectedvirtual
Todo:
....make this more flexible ..... ideally integrate into KLFLatexSymbolCache... with XML description, "symbols" that would be delimiters would have a "display latex" and an "insert latex" with instructions in if we need to go back spaces, etc..

Definition at line 88 of file klflatexedit.cpp.

References QMenu::addAction(), QMenu::addSeparator(), QTextEdit::createStandardContextMenu(), QTextEdit::cursorForPosition(), insertContextMenuActions(), QMenu::popup(), QAction::setData(), QAction::setMenu(), QTextEdit::setTextCursor(), QList::size(), QTextEdit::textCursor(), and KLFLatexSymbolsCache::theCache().

int KLFLatexEdit::heightHintLines ( ) const
inline

See sizeHint(). This gets the preferred height of this widget in number of text lines, as set by setHeightHintLints().

Definition at line 72 of file klflatexedit.h.

void KLFLatexEdit::insertContextMenuActions ( const QPoint pos,
QList< QAction * > *  actionList 
)
signal

This signal is emitted just before the context menu is shown. If someone wants to add entries into the context menu, then connect to this signal, and append new actions to the actionList.

Referenced by contextMenuEvent().

void KLFLatexEdit::insertDelimiter ( const QString delim,
int  charsBack = 1 
)
slot

Inserts a delimiter delim, and brings the cursor charsBack characters back. Eg. you can insert "\mathrm{}" and bring the cursor 1 space back.

Definition at line 178 of file klflatexedit.cpp.

References QTextCursor::beginEditBlock(), QTextCursor::endEditBlock(), QString::insert(), QTextCursor::insertText(), QString::isEmpty(), QString::length(), QTextCursor::movePosition(), QTextCursor::removeSelectedText(), QTextCursor::selection(), QTextEdit::setTextCursor(), and QTextEdit::textCursor().

void KLFLatexEdit::insertFromMimeData ( const QMimeData source)
protectedvirtual
void KLFLatexEdit::setHeightHintLines ( int  lines)
slot

See sizeHint(). This sets the preferred height of this widget in number of text lines.

Definition at line 81 of file klflatexedit.cpp.

void KLFLatexEdit::setLatex ( const QString latex)
slot

Sets the current latex code to latex.

Note
this function, unlike QTextEdit::setPlainText(), preserves undo history.

Definition at line 61 of file klflatexedit.cpp.

References QTextCursor::beginEditBlock(), QTextCursor::endEditBlock(), QTextCursor::insertText(), QTextCursor::removeSelectedText(), QTextCursor::select(), and QTextEdit::textCursor().

Referenced by clearLatex().

void KLFLatexEdit::setMainWinDataOpener ( KLFMainWin mainwin)
inline

This function may be used to give a pointer to a KLFMainWin that we will call to open data when we get a paste/drop. If they can open the data, then we consider the data pasted. Otherwise, rely on the QTextEdit built-in functionality.

This pointer may also be NULL, in which case we will only rely on QTextEdit built-in functionality.

Definition at line 68 of file klflatexedit.h.

QSize KLFLatexEdit::sizeHint ( ) const
virtual

The size hint of the widget. If heightHintLines() is set to -1, this directly calles the superclass function. Otherwise this returns the size in pixels this widget wants to have, given the value of heightHintLines() number of lines in the current font.

Definition at line 72 of file klflatexedit.cpp.

References QFontMetrics::height(), and QSize::width().

KLFLatexSyntaxHighlighter* KLFLatexEdit::syntaxHighlighter ( )
inline

Definition at line 60 of file klflatexedit.h.


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

Generated by doxygen 1.8.8