Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 42 lines (38 sloc) 0.982 kb
f3516c8 First commit
Mandarancio authored
1 #include "searchbutton.h"
2 #include <QPainter>
3 #include <QPen>
4
5 SearchButton::SearchButton(QWidget *parent) :
6 QToolButton(parent)
7 {
8 this->setCheckable(true);
9 }
10
11 void SearchButton::paintEvent(QPaintEvent *e){
12 QPainter p(this);
13 p.setRenderHint(p.Antialiasing);
14 QColor fg;
15 if (this->isChecked()){
16 QColor c1,c2;
17 QLinearGradient lg1(0,0,0,this->height());
18 c1.setRgb(54,102,164);
19 c2.setRgb(102,157,206);
20 p.setPen(c1);
21 lg1.setColorAt(0,c2);
22 lg1.setColorAt(1,c1);
23 p.setBrush(lg1);
24 p.drawRect(0,0,this->width(),this->height());
25 fg.setRgb(255,255,255);
26 }
27 else fg.setRgb(60,60,60);
28 QPen p1;
29 p1.setColor(fg);
30 p1.setWidth(4);
31 p1.setCapStyle(Qt::RoundCap);
32 p.setBrush(Qt::transparent);
33 p.setPen(p1);
34 int xc,yc;
35 xc=this->width()/2;
36 yc=this->height()/2;
37 p.drawEllipse(xc-7,yc-6,10,10);
38 p.drawLine(xc+2,yc+4,xc+5,yc+8);
39
40 e->accept();
41 }
Something went wrong with that request. Please try again.