srchiliteqt::TextEditHighlighted Class Reference

A specialized QTextEdit that uses a Qt4SyntaxHighlighter for highlighting its contents. More...

#include <TextEditHighlighted.h>

Collaboration diagram for srchiliteqt::TextEditHighlighted:
[legend]

List of all members.

Public Slots

void changeHighlightingLanguage (const QString &newLang)
 Changes the highlighting according to the new specified language.
void changeHighlightingStyle (const QString &newStyle)
 Changes the highlighting style according to the new specified style file.
void changeFileName (const QString &fileName)
 If the file name changes, then we check whether we need to change the language definition for highlighting.

Signals

void changedHighlightingLanguage (const QString &newLang)
 This signal is emitted when the highlighting language definition changed.
void changedHighlightingStyle (const QString &newLang)
 This signal is emitted when the highlighting style changed.

Public Member Functions

void connectLanguageComboBox (LanguageComboBox *lcb)
 Connects a LanguageComboBox so that, if the language is changed it automatically rehighlights the contents of the textedit.
void connectStyleComboBox (StyleComboBox *lcb)
 Connects a StyleComboBox so that, if the style is changed it automatically rehighlights the contents of the textedit.
srchiliteqt::Qt4SyntaxHighlightergetHighlighter () const
void setHighlighter (const QString &langFile)
 Sets an highlighter for the specified language definition file and with the specified styleFile.
const QString loadFile (const QString &fileName)
 Opens the file specified by fileName.
void changeColors (const QString &fgColor, const QString &bgColor)
 Changes the foreground and background color.

Private Attributes

srchiliteqt::Qt4SyntaxHighlighterhighlighter
 the highlighter object
LanguageComboBoxlanguageComboBox
 the (possible) LanguageComboBox for selecting languages
StyleComboBoxstyleComboBox
 the (possible) StyleComboBox for selecting languages
QString styleFile
 the style file of source-highlight for highlighting (default: "default.style")


Detailed Description

A specialized QTextEdit that uses a Qt4SyntaxHighlighter for highlighting its contents.

If connected to a LanguageComboBox, it automatically refreshes its highlighted contents when the language definition file changes. If connected to a StyleComboBox, it automatically refreshes its highlighted contents when the style changes.


Member Function Documentation

void srchiliteqt::TextEditHighlighted::changeColors ( const QString &  fgColor,
const QString &  bgColor 
)

Changes the foreground and background color.

Parameters:
fgColor the foreground (if empty, the color is not changed)
bgColor the background (if empty, the color is not changed)

void srchiliteqt::TextEditHighlighted::changedHighlightingLanguage ( const QString &  newLang  )  [signal]

This signal is emitted when the highlighting language definition changed.

Parameters:
newLang the new language definition

void srchiliteqt::TextEditHighlighted::changedHighlightingStyle ( const QString &  newLang  )  [signal]

This signal is emitted when the highlighting style changed.

Parameters:
newLang the new language definition

void srchiliteqt::TextEditHighlighted::changeFileName ( const QString &  fileName  )  [slot]

If the file name changes, then we check whether we need to change the language definition for highlighting.

Parameters:
fileName the new file name

void srchiliteqt::TextEditHighlighted::changeHighlightingLanguage ( const QString &  newLang  )  [slot]

Changes the highlighting according to the new specified language.

Parameters:
newLang the new language definition

void srchiliteqt::TextEditHighlighted::changeHighlightingStyle ( const QString &  newStyle  )  [slot]

Changes the highlighting style according to the new specified style file.

Parameters:
newStyle the new style

void srchiliteqt::TextEditHighlighted::connectLanguageComboBox ( LanguageComboBox lcb  ) 

Connects a LanguageComboBox so that, if the language is changed it automatically rehighlights the contents of the textedit.

Parameters:
lcb the LanguageComboBox

void srchiliteqt::TextEditHighlighted::connectStyleComboBox ( StyleComboBox lcb  ) 

Connects a StyleComboBox so that, if the style is changed it automatically rehighlights the contents of the textedit.

Parameters:
lcb the LanguageComboBox

const QString srchiliteqt::TextEditHighlighted::loadFile ( const QString &  fileName  ) 

Opens the file specified by fileName.

It uses the fileName to detect the source language and automatically selects the corresponding syntax highlighting.

Parameters:
fileName the name of the file to open (complete path)
Returns:
a string representing the error. If successful returns the empty string

void srchiliteqt::TextEditHighlighted::setHighlighter ( const QString &  langFile  ) 

Sets an highlighter for the specified language definition file and with the specified styleFile.

Parameters:
langFile 


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

Generated on Tue Aug 11 19:49:21 2009 for Source-highlight Qt Library by  doxygen 1.5.9