PSQt/src/gradient.cpp

Go to the documentation of this file.
00001 //---------------------------------------------------------------------
00002 // File and Version Information:
00003 //   $Id: gradient.cpp 9841 2015-03-26 18:35:44Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Author: Mikhail S. Dubrovin
00006 //---------------------------------------------------------------------
00007 
00008 
00009 #include "PSQt/gradient.h"
00010 #include <QApplication>
00011 #include <QPainter>
00012 
00013 namespace PSQt {
00014 
00015 Gradient::Gradient(QWidget *parent)
00016     : QWidget(parent)
00017 {
00018 }
00019 
00020 void Gradient::paintEvent(QPaintEvent *event)
00021 {
00022   QPainter painter(this);
00023 
00024   QLinearGradient grad1(0, 20, 0, 110);
00025   grad1.setColorAt(0.1, Qt::black);
00026   grad1.setColorAt(0.5, Qt::yellow);
00027   grad1.setColorAt(0.9, Qt::black);
00028   painter.fillRect(20, 20, 300, 90, grad1);
00029 
00030   QLinearGradient grad2(0, 55, 250, 0);
00031   grad2.setColorAt(0.2, Qt::black);
00032   grad2.setColorAt(0.5, Qt::red);
00033   grad2.setColorAt(0.8, Qt::black);
00034   painter.fillRect(20, 140, 300, 100, grad2);
00035 }
00036 
00037 } // namespace PSQt

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7