2 * Custom button class for customized button.
4 * @author Jukka Kurttila <jktla@suomi24.fi>
5 * @copyright (c) 2010 Speed Freak team
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9 #include "custombutton.h"
15 *Constructor of this class.
17 CustomButton::CustomButton(QWidget *parent, QIcon *icon) : QWidget(parent)
22 pict1 = new QPixmap(icon->pixmap(125,125,QIcon::Normal,QIcon::On));
23 pict2 = new QPixmap(icon->pixmap(125,125,QIcon::Normal,QIcon::Off));
27 *Destructor of this class.
29 CustomButton::~CustomButton()
37 void CustomButton::paintEvent(QPaintEvent *)
39 QPainter painter(this);
42 painter.drawPixmap(0,0,*pict2);
44 painter.drawPixmap(0,0,*pict1);
47 //painter.drawText(50,50,"y: "+QString::number(mY));
49 void CustomButton::mousePressEvent(QMouseEvent* me)
54 void CustomButton::mouseReleaseEvent(QMouseEvent* me)
58 //Emit open dialog signal if mouse is still over button
59 if( mY < this->height() && mY > 0 && mX < this->width() && mX > 0 )
65 void CustomButton::mouseMoveEvent(QMouseEvent* me)
69 //Is mouse moved outside button?
70 if( mY > this->height() || mY < 0 || mX > this->width() || mX < 0 )