Newer
Older
Import / applications / voxels / colorselector.h
@John John on 29 Dec 2020 656 bytes bulk import from macbookpro checkouts
#ifndef __COLOR_SELECTOR_H__
#define __COLOR_SELECTOR_H__


#include <QLabel>
#include <QMouseEvent>
#include <QPixmap>
#include <QImage>


class ColorSelector : public QLabel
{
    Q_OBJECT
public:
    ColorSelector( QWidget *parent ) : QLabel(parent) {
        setPixmap(QPixmap("./colors.png"));
        setMargin(0);
    }

    ~ColorSelector() {
    }

    void mousePressEvent( QMouseEvent *me ) {
        QPoint pnt = me->pos();
        QImage img("./colors.png");
        QRgb rgb = img.pixel(pnt.x(), pnt.y());
        emit colorSelected( QColor(rgb) );
    }

signals:
    void colorSelected( QColor col );
};



#endif //  __COLOR_SELECTOR_H__