[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | 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 setWrapLines (bool wrap)
 
void setHeightHintLines (int lines)
 
void insertDelimiter (const QString &delim, int charsBack=1)
 
void setPalette (const QPalette &palette)
 

Signals

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

Public Member Functions

 KLFLatexEdit (QWidget *parent)
 
virtual ~KLFLatexEdit ()
 
KLFLatexSyntaxHighlightersyntaxHighlighter ()
 
void setDropDataHandler (KLFDropDataHandler *handler)
 
int heightHintLines () const
 
virtual QSize sizeHint () const
 
QString latex () const
 
bool wrapLines () const
 

Protected Member Functions

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

Properties

int heightHintLines
 
bool wrapLines
 

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::KLFLatexEdit ( QWidget *  parent)

Definition at line 199 of file klflatexedit.cpp.

References KLF_INIT_PRIVATE, and QPalette::setColor().

◆ ~KLFLatexEdit()

KLFLatexEdit::~KLFLatexEdit ( )
virtual

Definition at line 221 of file klflatexedit.cpp.

References KLF_DELETE_PRIVATE.

Member Function Documentation

◆ canInsertFromMimeData()

bool KLFLatexEdit::canInsertFromMimeData ( const QMimeData source) const
protectedvirtual

Definition at line 314 of file klflatexedit.cpp.

References QMimeData::formats(), and klfDbg.

◆ clearLatex

void KLFLatexEdit::clearLatex ( )
slot

Definition at line 243 of file klflatexedit.cpp.

References setLatex().

◆ contextMenuEvent()

void KLFLatexEdit::contextMenuEvent ( QContextMenuEvent event)
protectedvirtual

Definition at line 287 of file klflatexedit.cpp.

References insertContextMenuActions(), and QList::size().

◆ heightHintLines()

int KLFLatexEdit::heightHintLines ( ) const

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

Referenced by latex().

◆ insertContextMenuActions

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().

◆ insertDelimiter

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 345 of file klflatexedit.cpp.

References QTextCursor::beginEditBlock(), QTextCursor::endEditBlock(), QString::insert(), QTextCursor::insertText(), QString::isEmpty(), QString::length(), QTextCursor::movePosition(), QTextCursor::removeSelectedText(), QTextCursor::selection(), and QTextDocumentFragment::toPlainText().

◆ insertFromMimeData()

void KLFLatexEdit::insertFromMimeData ( const QMimeData source)
protectedvirtual

◆ latex()

QString KLFLatexEdit::latex ( ) const

Definition at line 226 of file klflatexedit.cpp.

References heightHintLines().

◆ setDropDataHandler()

void KLFLatexEdit::setDropDataHandler ( KLFDropDataHandler handler)

This function may be used to give a pointer to a KLFDropDataHandler 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 234 of file klflatexedit.cpp.

◆ setHeightHintLines

void KLFLatexEdit::setHeightHintLines ( int  lines)
slot

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

Definition at line 280 of file klflatexedit.cpp.

◆ setLatex

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 250 of file klflatexedit.cpp.

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

Referenced by clearLatex().

◆ setPalette

void KLFLatexEdit::setPalette ( const QPalette palette)
slot

Directly calls the superclass' method. This is just used so that we have a slot.

Definition at line 365 of file klflatexedit.cpp.

References QObject::inherits(), KLF_FUNC_NAME, and QVariant::toMap().

◆ setWrapLines

void KLFLatexEdit::setWrapLines ( bool  wrap)
slot

Set to TRUE to wrap lines, false to have a horizontal scroll. This directly calls QTextEdit::setWordWrapMode() with either QTextOption::NoWrap (FALSE) or QTextOption::WrapAnywhere.

Definition at line 265 of file klflatexedit.cpp.

◆ sizeHint()

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 271 of file klflatexedit.cpp.

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

◆ syntaxHighlighter()

KLFLatexSyntaxHighlighter * KLFLatexEdit::syntaxHighlighter ( )

Definition at line 238 of file klflatexedit.cpp.

◆ wrapLines()

bool KLFLatexEdit::wrapLines ( ) const

Referenced by setLatex().

Property Documentation

◆ heightHintLines

int KLFLatexEdit::heightHintLines
readwrite

Definition at line 55 of file klflatexedit.h.

◆ wrapLines

bool KLFLatexEdit::wrapLines
readwrite

Definition at line 55 of file klflatexedit.h.


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

Generated by doxygen 1.8.13