Home

qtcolorcombobox.h

This is the verbatim text of the qtcolorcombobox.h include file. It is provided only for illustration; the copyright remains with Trolltech.


#ifndef COLORCOMBOBOX_H
#define COLORCOMBOBOX_H
#include <qcombobox.h>
#include <qcolor.h>

#if defined(Q_WS_WIN)
#  if !defined(QT_QTCOLORCOMBOBOX_EXPORT) && !defined(QT_QTCOLORCOMBOBOX_IMPORT)
#    define QT_QTCOLORCOMBOBOX_EXPORT
#  elif defined(QT_QTCOLORCOMBOBOX_IMPORT)
#    if defined(QT_QTCOLORCOMBOBOX_EXPORT)
#      undef QT_QTCOLORCOMBOBOX_EXPORT
#    endif
#    define QT_QTCOLORCOMBOBOX_EXPORT __declspec(dllimport)
#  elif defined(QT_QTCOLORCOMBOBOX_EXPORT)
#    undef QT_QTCOLORCOMBOBOX_EXPORT
#    define QT_QTCOLORCOMBOBOX_EXPORT __declspec(dllexport)
#  endif
#else
#  define QT_QTCOLORCOMBOBOX_EXPORT
#endif

class QT_QTCOLORCOMBOBOX_EXPORT QtColorComboBox : public QComboBox
{
    Q_OBJECT
public:
    QtColorComboBox(QWidget *parent = 0, const char *name = 0);

    void insertColor(const QColor &color, const QString &name, int index = -1);

    void setCurrentColor(const QColor &color);
    QColor currentColor() const;

    QColor color(int index) const;

    void setColorDialogEnabled(bool enabled = true);
    bool isColorDialogEnabled() const;

    void setStandardColors();

    QSize sizeHint() const;

signals:
    void activated(const QColor &color);
    void highlighted(const QColor &color);

private slots:
    void emitActivatedColor(int index);
    void emitHighlightedColor(int index);

private:
    QColor lastActivated;
    int numUserColors;
    bool colorDialogEnabled;
};

#endif

Copyright © 2003-2006 TrolltechTrademarks
Qt Solutions