QTfrontend/ui/widget/colorwidget.h
author dag10
Mon, 21 Jan 2013 21:52:49 -0500
changeset 8424 225ede46e3dc
parent 7750 31e4f6c1834b
child 8434 4821897a0f10
permissions -rw-r--r--
On pagenetgame, when window is too small the map/game options becomes a tabbed interface to allow for a few lines of chat to always be visible. Restored HWForm's min height to 580. Fixed the 2px alignment issue with the map list and map previews' top edges that unC0Rr was whining about. <3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     1
#ifndef COLORWIDGET_H
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     2
#define COLORWIDGET_H
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     3
7749
edad8a7bcaea Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet
unc0rr
parents: 7130
diff changeset
     4
#include <QFrame>
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     5
#include <QModelIndex>
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     6
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     7
namespace Ui {
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     8
class ColorWidget;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
     9
}
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    10
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    11
class QStandardItemModel;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    12
7749
edad8a7bcaea Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet
unc0rr
parents: 7130
diff changeset
    13
class ColorWidget : public QFrame
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    14
{
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    15
    Q_OBJECT
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    16
    
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    17
public:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    18
    explicit ColorWidget(QStandardItemModel *colorsModel, QWidget *parent = 0);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    19
    ~ColorWidget();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    20
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    21
    void setColors(QStandardItemModel * colorsModel);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    22
    void setColor(int color);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    23
    int getColor();
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    24
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    25
signals:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    26
    void colorChanged(int color);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    27
    
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    28
private:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    29
    int m_color;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    30
    QStandardItemModel * m_colorsModel;
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    31
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    32
private slots:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    33
    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    34
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    35
protected:
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    36
    void mousePressEvent(QMouseEvent * event);
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    37
    void wheelEvent(QWheelEvent * event);
7750
31e4f6c1834b small tweak. (reverse mouse wheel directions for color change)
sheepluva
parents: 7749
diff changeset
    38
    void nextColor();
31e4f6c1834b small tweak. (reverse mouse wheel directions for color change)
sheepluva
parents: 7749
diff changeset
    39
    void previousColor();
7130
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    40
};
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    41
fcab1fd02bc6 - Allow switching colors with mouse wheel
unc0rr
parents:
diff changeset
    42
#endif // COLORWIDGET_H