srchiliteqt::ColorDialog Class Reference

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>

Collaboration diagram for srchiliteqt::ColorDialog:
Collaboration graph
[legend]

List of all members.

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

MainColorFormmainColorForm

Private Attributes

srchiliteqt::Qt4SyntaxHighlighterhighlighter
 the highlighter object
Ui::ColorDialog * m_ui
QMap< QString,
LanguageElemColorForm * > 
colorFormMap

Detailed Description

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());
    }

Constructor & Destructor Documentation

srchiliteqt::ColorDialog::ColorDialog ( srchiliteqt::Qt4SyntaxHighlighter highlighter_,
QWidget *  parent = 0 
) [explicit]
Parameters:
the associated Qt4SyntaxHighlighter

Member Function Documentation

void srchiliteqt::ColorDialog::addColorForm ( QWidget *  form  ) 

Addss a color form to this dialog.

Parameters:
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.


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

Generated on Sat Mar 6 11:22:59 2010 for Source-highlight Qt Library by  doxygen 1.6.1