srchiliteqt::TextEditHighlighted Class Reference
A specialized QTextEdit that uses a Qt4SyntaxHighlighter for highlighting its contents.
More...
#include <TextEditHighlighted.h>
List of all members.
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:
-
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:
-
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:
-
const QString srchiliteqt::TextEditHighlighted::getLangDefFileFromFileName |
( |
const QString & |
filename |
) |
[slot] |
Returns the the lang def file name by using the file name for detecting the syntax of the file (e.g., foo.cpp brings to cpp.lang, ChangeLog brings to changelog.lang).
This method already catches possible exceptions thrown from the source-highlight library and show them in a message box.
- Parameters:
-
- Returns:
- the lang def file name or the empty string if no mapping exists
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.
- Parameters:
-
The documentation for this class was generated from the following files:
- /home/bettini/workspaces/sourcehighlight/source-highlight-qt/lib/srchiliteqt/TextEditHighlighted.h
- /home/bettini/workspaces/sourcehighlight/source-highlight-qt/lib/srchiliteqt/TextEditHighlighted.cpp