00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "FrameColored.hpp"
00024
00025 #include <QWidget>
00026 #include <QPainter>
00027 #include <QPaintEvent>
00028
00029 #ifndef QT_NO_DEBUG
00030 #include <iostream>
00031 #endif
00032
00033 FrameColored :: FrameColored(QColor color, QWidget* parent )
00034 :QFrame(parent), color(color)
00035 {
00036 this->setMinimumSize(50,50);
00037 this->setGeometry(0,0,50,50);
00038
00039 #ifndef QT_NO_DEBUG
00040 std::cout << "FrameColored created" << std::endl;
00041 #endif
00042 }
00043
00044 FrameColored :: ~FrameColored(void)
00045 {
00046 #ifndef QT_NO_DEBUG
00047 std::cout << "FrameColored deleted" << std::endl;
00048 #endif
00049 }
00050
00051 void FrameColored :: paintEvent(QPaintEvent* )
00052 {
00053 #ifndef QT_NO_DEBUG
00054 std::cout << "FrameColore :: paintEvent()" << std::endl;
00055 #endif
00056
00057 QPainter p(this);
00058
00059 p.fillRect(QRect(0, 0, this->width(), this->height()), color);
00060
00061 p.setPen(QColor(0, 0, 0));
00062 p.drawLine(0, 0, this->width()-1, 0);
00063 p.drawLine(this->width()-1, 0, this->width()-1, this->height()-1);
00064 p.drawLine(this->width()-1, this->height()-1, 0, this->height()-1);
00065 p.drawLine(0, this->height()-1, 0, 0);
00066 }