/* * Pixmap Button, a custom Qt4 widget * Copyright (C) 2011-2013 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * For a full copy of the GNU General Public License see the GPL.txt file */ #ifndef __LEDBUTTON_HPP__ #define __LEDBUTTON_HPP__ #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) # include #else # include #endif class LEDButton : public QPushButton { Q_OBJECT public: enum Color { BLUE = 1, GREEN = 2, RED = 3, YELLOW = 4 }; LEDButton(QWidget* parent); ~LEDButton(); void setColor(Color color); protected: void paintEvent(QPaintEvent* event); private: Color fColor; QPixmap fPixmap; QRectF fPixmapRect; }; #endif // __LEDBUTTON_HPP__