#include <TextEditHighlighted.h>
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::Qt4SyntaxHighlighter * | getHighlighter () 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::Qt4SyntaxHighlighter * | highlighter |
the highlighter object | |
LanguageComboBox * | languageComboBox |
the (possible) LanguageComboBox for selecting languages | |
StyleComboBox * | styleComboBox |
the (possible) StyleComboBox for selecting languages | |
QString | styleFile |
the style file of source-highlight for highlighting (default: "default.style") |
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.
void srchiliteqt::TextEditHighlighted::changeColors | ( | const QString & | fgColor, | |
const QString & | bgColor | |||
) |
Changes the foreground and background color.
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.
newLang | the new language definition |
void srchiliteqt::TextEditHighlighted::changedHighlightingStyle | ( | const QString & | newLang | ) | [signal] |
This signal is emitted when the highlighting style changed.
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.
fileName | the new file name |
void srchiliteqt::TextEditHighlighted::changeHighlightingLanguage | ( | const QString & | newLang | ) | [slot] |
Changes the highlighting according to the new specified language.
newLang | the new language definition |
void srchiliteqt::TextEditHighlighted::changeHighlightingStyle | ( | const QString & | newStyle | ) | [slot] |
Changes the highlighting style according to the new specified style file.
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.
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.
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.
fileName | the name of the file to open (complete path) |
void srchiliteqt::TextEditHighlighted::setHighlighter | ( | const QString & | langFile | ) |
Sets an highlighter for the specified language definition file and with the specified styleFile.
langFile |