QTfrontend/ui/widget/colorwidget.h
author unc0rr
Sat, 13 Oct 2012 00:35:20 +0400
changeset 7749 edad8a7bcaea
parent 7130 fcab1fd02bc6
child 7750 31e4f6c1834b
permissions -rw-r--r--
Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet

#ifndef COLORWIDGET_H
#define COLORWIDGET_H

#include <QFrame>
#include <QModelIndex>

namespace Ui {
class ColorWidget;
}

class QStandardItemModel;

class ColorWidget : public QFrame
{
    Q_OBJECT
    
public:
    explicit ColorWidget(QStandardItemModel *colorsModel, QWidget *parent = 0);
    ~ColorWidget();

    void setColors(QStandardItemModel * colorsModel);
    void setColor(int color);
    int getColor();

signals:
    void colorChanged(int color);
    
private:
    int m_color;
    QStandardItemModel * m_colorsModel;

private slots:
    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);

protected:
    void mousePressEvent(QMouseEvent * event);
    void wheelEvent(QWheelEvent * event);
};

#endif // COLORWIDGET_H