PSQt/src/custombutton.cpp

Go to the documentation of this file.
00001 //---------------------------------------------------------------------
00002 // File and Version Information:
00003 //   $Id: custombutton.cpp 9841 2015-03-26 18:35:44Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Author: Mikhail S. Dubrovin
00006 //---------------------------------------------------------------------
00007 
00008 
00009 #include "PSQt/custombutton.h"
00010 #include <QApplication>
00011 #include <QPainter>
00012 
00013 namespace PSQt {
00014 
00015 CustomButton::CustomButton(QWidget *parent)
00016     : QPushButton(parent)
00017 {  
00018 }
00019 
00020 CustomButton::~CustomButton()
00021 {
00022 }
00023 
00024 //Paint event of button
00025 void CustomButton::paintEvent(QPaintEvent *paint)
00026 {
00027     QPushButton::paintEvent(paint);
00028     QPainter p(this);
00029     p.save();
00030 
00031     p.setPen(Qt::blue);                  
00032     p.setFont(QFont("Arial", 20));       
00033     p.drawText(QPoint( 10, 22),"Custom");
00034     p.drawText(QPoint(110, 22),"Button");
00035     p.drawText(QPoint(210, 22),"Test"); 
00036 
00037     QPen pen(Qt::red, 4, Qt::SolidLine); // Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine
00038     p.setPen(pen);                  
00039     p.drawLine(260, 5, 400, 15);
00040 
00041     //p.drawImage(QPoint(300,300),SimpleIcon);
00042     p.restore();
00043 }
00044 
00045 } // namespace PSQt

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7