#include "dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
resize(800,600);
}
Dialog::~Dialog()
{
}
//从这个程序开始,能贴图的尽量全部贴图
void Dialog::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing,true);
painter.fillRect(0,0,800,600,Qt::black);
//上面的一根线
//painter.setPen(QColor(1,90,206));
//painter.drawLine(0,37,800,37);
//上面的菜单栏,直接采用贴图,单个贴图效果不好
//QPixmap st(":/st.jpg");
//painter.drawPixmap(0,0,800,37,st);
QPixmap menu_top(":/menu_top.jpg");
painter.drawPixmap(0,0,800,39,menu_top);
QPixmap menu_status_select(":/menu_STATUS_select.jpg");
painter.drawPixmap(430,0,128,39,menu_status_select);
//下面的状态栏
QPixmap DOC(":/DOC.jpg");
painter.drawPixmap(0,563,95,37,DOC);
//下面的长条
QPixmap bottom_info(":/bottom_info.png");
painter.drawPixmap(97,562,512,38,bottom_info);
//DCC
QPixmap DCC(":/DCC.jpg");
painter.drawPixmap(612,562,99,38,DCC);
//DCA
QPixmap DCA(":/DCA.jpg");
painter.drawPixmap(711,562,92,38,DCA);
QFont font11("",11);
font11.setBold(true);
painter.setFont(font11);
painter.setPen(Qt::white);
//先画下面的简单的部分,两个矩形,从右到左
/*QLinearGradient grad2(569,458,569,488);
grad2.setColorAt(0.2,QColor(33,199,0));
grad2.setColorAt(0.5,QColor(27,165,0));
grad2.setColorAt(1.0,QColor(33,199,0));
painter.fillRect(569,458,60,31,grad2);*/
QPixmap status_ok(":/status_ok.png");
painter.drawPixmap(569,458,60,31,status_ok);
/*QLinearGradient grad4(680,458,680,488);
grad4.setColorAt(0.2,QColor(247,0,45));
grad4.setColorAt(0.5,QColor(206,0,38));
grad4.setColorAt(1.0,QColor(247,0,45));
painter.fillRect(680,458,60,31,grad4);*/
QPixmap status_fault(":/status_fault.png");
painter.drawPixmap(680,458,60,31,status_fault);
QPixmap scrollbar_up(":/scrollbar_up.png");
painter.drawPixmap(533,440,21,34,scrollbar_up);
QPixmap scrollbar_handle(":/scrollbar_handle.png");
painter.drawPixmap(534,473,20,20,scrollbar_handle);
QPixmap scrollbar_down(":/scrollbar_down.png");
painter.drawPixmap(534,504,21,34,scrollbar_down);
painter.setPen(QColor(0,78,180));
QLinearGradient grad5(32,397,502,397);
grad5.setColorAt(0.0,QColor(0,18,42));
grad5.setColorAt(0.1,QColor(0,91,180));
grad5.setColorAt(0.9,QColor(0,91,180));
grad5.setColorAt(1.0,QColor(0,18,42));
painter.setPen(QPen(QBrush(grad5),1));
//painter.drawLine(32,397,502,397);
//painter.drawLine(32,432,502,432);
QPixmap slider_bg(":/slider_bg.png");
painter.drawPixmap(27,395,483,10,slider_bg);
QPixmap table_status_row(":/table_status_row.png");
painter.drawPixmap(27,411,483,24,table_status_row);
// painter.drawLine(32,462,502,462);
painter.drawPixmap(27,442,483,22,table_status_row);
// painter.drawLine(32,485,502,485);
painter.drawPixmap(27,465,483,22,table_status_row);
// painter.drawLine(32,508,502,508);
painter.drawPixmap(27,491,483,22,table_status_row);
// painter.drawLine(32,513,502,531);
painter.drawPixmap(27,513,483,22,table_status_row);
//QLinearGradient grad6(212,400,212,430);
//grad6.setColorAt(0.1,QColor(0,0,0));
//grad6.setColorAt(0.5,QColor(0,5,13));
//grad6.setColorAt(1.0,QColor(0,24,60));
//painter.fillRect(32,400,462,31,grad6);
//QLinearGradient grad7(212,439,212,460);
//grad7.setColorAt(0.1,QColor(0,0,0));
//grad7.setColorAt(0.5,QColor(0,13,32));
//grad7.setColorAt(1.0,QColor(0,21,52));
//painter.fillRect(32,436,462,25,grad7);
//QLinearGradient grad8(212,464,212,484);
//grad8.setColorAt(0.1,QColor(0,0,0));
//grad8.setColorAt(0.5,QColor(0,13,32));
//grad8.setColorAt(1.0,QColor(0,21,52));
//painter.fillRect(32,466,462,18,grad8);
//painter.save();
//painter.translate(0,23);
//painter.fillRect(32,466,462,18,grad8);
//painter.translate(0,23);
// painter.fillRect(32,466,462,18,grad8);
// painter.restore();
//painter.setPen(QColor(0,89,204));
//painter.drawLine(110,405,110,432);
//painter.drawLine(110,443,110,461);
//painter.drawLine(110,467,110,485);
//painter.drawLine(110,491,110,509);
// painter.drawLine(110,513,110,532);
// painter.drawLine(226,405,226,432);
// painter.drawLine(226,443,226,461);
//painter.drawLine(226,467,226,485);
//painter.drawLine(226,491,226,509);
// painter.drawLine(226,513,226,532);
// painter.drawLine(342,405,342,432);
// painter.drawLine(342,443,342,461);
// painter.drawLine(342,467,342,485);
// painter.drawLine(342,491,342,509);
//painter.drawLine(342,513,342,532);
//用drawconvexpolgon画中间图,阴影和轮廓
/*QLinearGradient grad9(386,126,386,368);
grad9.setColorAt(0.0,QColor(6,50,106));
grad9.setColorAt(0.2,QColor(6,34,69));
grad9.setColorAt(0.3,QColor(6,26,51));
grad9.setColorAt(0.7,QColor(6,26,51));
grad9.setColorAt(0.8,QColor(6,34,69));
grad9.setColorAt(1.0,QColor(6,50,106));
painter.setBrush(QBrush(grad9));
painter.setPen(QColor(0,83,191));
painter.drawConvexPolygon(point,31);
//画中间的门
painter.setPen(QColor(2,89,201));
painter.drawLine(239,124,239,196);
painter.drawLine(207,148,239,196);
painter.drawLine(239,264,239,369);
painter.drawArc(174,136,128,128,16.0*120,150*16.0);*/
// painter.setBrush(QColor(245,0,45));画红色矩形 从上到下
//插入status_device_middle
QPixmap status_device_tail(":/status_device_tail.png");
painter.drawPixmap(0,124,800,248,status_device_tail);
// painter.fillRect(111,129,76,21,QBrush(QColor(31,186,0)));//DACU
painter.drawPixmap(640,331,76,21,status_ok);
// painter.fillRect(209,128,76,21,QBrush(QColor(31,186,0)));//DMD_7
painter.drawPixmap(209-82-15,128,76,21,status_ok);
//painter.fillRect(406-82,128,76,21,QBrush(QColor(31,186,0)));//DMD_5
painter.drawPixmap(406-82-82-15,128,76,21,status_ok);
//painter.fillRect(523-82,128,76,21,QBrush(QColor(31,186,0)));//DMD_3
painter.drawPixmap(523-82-82-15,128,76,21,status_ok);
//painter.fillRect(640-82,128,76,21,QBrush(QColor(31,186,0)));//DMD_1
painter.drawPixmap(640-82-82-15,128,76,21,status_ok);
//painter.fillRect(111,341,76,21,QBrush(QColor(31,186,0)));//PISC
painter.drawPixmap(633,137,76,21,status_ok);
//painter.fillRect(289-82,341,76,21,QBrush(QColor(31,186,0)));//DMD_8
painter.drawPixmap(289-82-82-15,341,76,21,status_ok);
//painter.fillRect(406-82,341,76,21,QBrush(QColor(31,186,0)));//DMD_6
painter.drawPixmap(406-82-82-15,341,76,21,status_ok);
//painter.fillRect(523-82,341,76,21,QBrush(QColor(31,186,0)));//DMD_4
painter.drawPixmap(523-82-82-15,341,76,21,status_ok);
//painter.fillRect(640-82,341,76,21,QBrush(QColor(31,186,0)));//DMD_2
painter.drawPixmap(640-82-82-15,341,76,21,status_ok);
//painter.fillRect(260,158,76,21,QBrush(QColor(31,186,0)));//PECU_5
painter.drawPixmap(260-82-15,158,76,21,status_ok);
//painter.fillRect(375,158,76,21,QBrush(QColor(31,186,0)));//PECU_3
painter.drawPixmap(375-82-15,158,76,21,status_ok);
//painter.fillRect(488,310,76,21,QBrush(QColor(31,186,0)));//PECU_1
painter.drawPixmap(488-82-15,158,76,21,status_ok);
//painter.fillRect(260,310,76,21,QBrush(QColor(31,186,0)));//PECU_4
painter.drawPixmap(260-82-15,310,76,21,status_ok);
//painter.fillRect(488,310,76,21,QBrush(QColor(31,186,0)));//PECU_2
painter.drawPixmap(488-82-15,310,76,21,status_ok);
//painter.fillRect(72,190,78,28,QBrush(QColor(31,186,0)));//MDS
painter.drawPixmap(698,276,78,22,status_ok);
// p