A dialog to change the colors of the foreground and background of an editor and of the font properties and colors of the language elements to highlight. More...
#include <ColorDialog.h>
Public Member Functions | |
ColorDialog (srchiliteqt::Qt4SyntaxHighlighter *highlighter_, QWidget *parent=0) | |
void | addColorForm (QWidget *form) |
Addss a color form to this dialog. | |
void | syncFormatters () |
Updates the text formatter of the highlighter using the colors and font properties of the language element forms of this dialog. | |
Protected Member Functions | |
virtual void | changeEvent (QEvent *e) |
Protected Attributes | |
MainColorForm * | mainColorForm |
Private Attributes | |
srchiliteqt::Qt4SyntaxHighlighter * | highlighter |
the highlighter object | |
Ui::ColorDialog * | m_ui |
QMap< QString, LanguageElemColorForm * > | colorFormMap |
A dialog to change the colors of the foreground and background of an editor and of the font properties and colors of the language elements to highlight.
The dialog automatically fills the current properties by using the passed Qt4SyntaxHighlighter. You can use the method syncFormatters() to update the formatters of the highlighter with the value set in the dialog, e.g.,
ColorDialog dialog(textEdit->getHighlighter(), this); if (dialog.exec() == QDialog::Accepted) { dialog.syncFormatters(); textEdit->getHighlighter()->rehighlight(); // updating text editor colors is still up to us textEdit->changeColors( textEdit->getHighlighter()->getForegroundColor(), textEdit->getHighlighter()->getBackgroundColor()); }
srchiliteqt::ColorDialog::ColorDialog | ( | srchiliteqt::Qt4SyntaxHighlighter * | highlighter_, | |
QWidget * | parent = 0 | |||
) | [explicit] |
the | associated Qt4SyntaxHighlighter |
void srchiliteqt::ColorDialog::addColorForm | ( | QWidget * | form | ) |
Addss a color form to this dialog.
the | color form to add |
void srchiliteqt::ColorDialog::syncFormatters | ( | ) |
Updates the text formatter of the highlighter using the colors and font properties of the language element forms of this dialog.
You should call this if the dialog is closed with the accept button.