comparison widgets/RadialLNFButton.cpp @ 159:685e31447355

add videoIcon and new LNF for the advanced toolbox
author benoitrigolleau
date Thu, 15 Nov 2007 14:41:11 +0000
parents
children
comparison
equal deleted inserted replaced
158:9441b45b1e7f 159:685e31447355
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sound Access
5 EASAIER client application.
6 Silogic 2007. Benoit Rigolleau.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15
16 #include "RadialLNFButton.h"
17 #include <QPainter>
18 #include <QPalette>
19
20 RadialLNFButton::RadialLNFButton(QWidget *parent):QPushButton(parent)
21 {
22 this->setFlat(true);
23 }
24
25 RadialLNFButton::RadialLNFButton (const QIcon & icon, const QString & text, QWidget * parent ):QPushButton(icon,text,parent)
26 {
27 this->setFlat(true);
28 }
29
30 void RadialLNFButton::paintEvent(QPaintEvent *event)
31 {
32
33
34 QPainter painter(this);
35 painter.setRenderHint(QPainter::Antialiasing, false);
36 draw(&painter);
37 QPushButton::paintEvent(event);
38 }
39
40 void RadialLNFButton::draw(QPainter *painter)
41 {
42
43 QPalette actualPalette;
44 QColor color1 = actualPalette.color(QPalette::Highlight);
45 QColor color2 = actualPalette.color(QPalette::Button);
46 //QColor color3(QRgb(0xffffcc15));
47
48 color1.setAlpha(90);
49 //color3.setAlpha(70)
50 //color2.setAlpha(80);
51
52 //QColor color1(QRgb(0xffaaaaaa));
53
54 //QColor color2(QRgb(0xffdbf756));
55 //color2.setAlpha(100);
56
57
58 painter->setPen(QPen(palette().foreground(),1,Qt::NoPen,Qt::RoundCap));
59
60 /*
61 int rectsize = this->width()/20;
62 for(int i=0;i<=20;i++){
63 if((i+m_ind)%2){
64 painter->setBrush(QBrush(color1, Qt::SolidPattern));
65 }
66 else{
67 painter->setBrush(QBrush(Qt::white, Qt::SolidPattern));
68 }
69 painter->drawRect(i*rectsize,0,this->width(), this->height());
70 }
71 */
72
73 QLinearGradient rectRadian(0,0,this->width(),0);
74 rectRadian.setColorAt(0,color1);
75 rectRadian.setColorAt(0.8,color2);
76 rectRadian.setColorAt(1,color2);
77
78 painter->setPen(QPen(palette().foreground(),1,Qt::NoPen,Qt::RoundCap));
79 painter->setBrush(rectRadian);
80 painter->drawRect(0,0,this->width(), this->height());
81 }