PSQt/src/donut.cpp

Go to the documentation of this file.
00001 //---------------------------------------------------------------------
00002 // File and Version Information:
00003 //   $Id: donut.cpp 9841 2015-03-26 18:35:44Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Author: Mikhail S. Dubrovin
00006 //---------------------------------------------------------------------
00007 #include "PSQt/donut.h"
00008 #include <QApplication>
00009 #include <QPainter>
00010 
00011 namespace PSQt {
00012 
00013 Donut::Donut(QWidget *parent)
00014     : QWidget(parent)
00015 {
00016 }
00017 
00018 void Donut::paintEvent(QPaintEvent *event)
00019 {
00020   this -> setMinimumHeight(280);  
00021 
00022   //QPalette palette(Qt::white); //palette.setColor(QPalette::Base,Qt::yellow);
00023   //QPalette palette(QColor(255, 255, 255, 255)); // QColor(R,G,B,Alpha) palette.setColor(QPalette::Base,Qt::yellow);
00024   setPalette (QPalette(QColor(255, 255, 255, 255))); // Set QPalette for QWidget
00025   setAutoFillBackground (true); // MUST BE TRUE TO DRAW THE BACKGROUND COLOR SET IN Palette
00026 
00027   QPainter painter(this);
00028 
00029   painter.setPen(QPen(QBrush("#535353"), 0.5));
00030 
00031   painter.setRenderHint(QPainter::Antialiasing);
00032 
00033   int h = height();
00034   int w = width();
00035 
00036   painter.translate(QPoint(w/2, h/2));
00037 
00038   for (qreal rot=0; rot < 360.0; rot+=5.0 ) {
00039       painter.drawEllipse(-125, -40, 250, 80);
00040       painter.rotate(5.0);
00041   }
00042 }
00043 
00044 } // namespace PSQt

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7