Mercurial > hg > easaier-soundaccess
view 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 |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Sound Access EASAIER client application. Silogic 2007. Benoit Rigolleau. 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 (at your option) any later version. See the file COPYING included with this distribution for more information. */ #include "RadialLNFButton.h" #include <QPainter> #include <QPalette> RadialLNFButton::RadialLNFButton(QWidget *parent):QPushButton(parent) { this->setFlat(true); } RadialLNFButton::RadialLNFButton (const QIcon & icon, const QString & text, QWidget * parent ):QPushButton(icon,text,parent) { this->setFlat(true); } void RadialLNFButton::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, false); draw(&painter); QPushButton::paintEvent(event); } void RadialLNFButton::draw(QPainter *painter) { QPalette actualPalette; QColor color1 = actualPalette.color(QPalette::Highlight); QColor color2 = actualPalette.color(QPalette::Button); //QColor color3(QRgb(0xffffcc15)); color1.setAlpha(90); //color3.setAlpha(70) //color2.setAlpha(80); //QColor color1(QRgb(0xffaaaaaa)); //QColor color2(QRgb(0xffdbf756)); //color2.setAlpha(100); painter->setPen(QPen(palette().foreground(),1,Qt::NoPen,Qt::RoundCap)); /* int rectsize = this->width()/20; for(int i=0;i<=20;i++){ if((i+m_ind)%2){ painter->setBrush(QBrush(color1, Qt::SolidPattern)); } else{ painter->setBrush(QBrush(Qt::white, Qt::SolidPattern)); } painter->drawRect(i*rectsize,0,this->width(), this->height()); } */ QLinearGradient rectRadian(0,0,this->width(),0); rectRadian.setColorAt(0,color1); rectRadian.setColorAt(0.8,color2); rectRadian.setColorAt(1,color2); painter->setPen(QPen(palette().foreground(),1,Qt::NoPen,Qt::RoundCap)); painter->setBrush(rectRadian); painter->drawRect(0,0,this->width(), this->height()); }