資源簡介
flag.rar

代碼片段和文件信息
#include?“dialog.h“
#include?“ui_dialog.h“
#include?
Dialog::Dialog(QWidget?*parent)?:
????QDialog(parent)
????ui(new?Ui::Dialog)
{
????ui->setupUi(this);
}
Dialog::~Dialog()
{
????delete?ui;
}
void?Dialog::paintEvent(QPaintEvent?*)
{
????QPainter?qp(this);
????QRect?rc(0?0?rect().width()?rect().height());
????qp.fillRect(rc?Qt::red);?//?填充藍色矩形
????QPainterPath?path1;
????path1.lineTo(rect().width()*0.70);
????path1.lineTo(0rect().height());
????path1.lineTo(00);
????//qp.setBrush(QBrush(Qt::red));
????//qp.drawPath(path1);
????qp.fillPath(path1?QBrush(Qt::green));
????QPainterPath?path2;
????path2.moveTo(rect().width()*0.70);
????path2.lineTo(rect().width()?0);
????path2.lineTo(rect().width()*0.3?rect().height());
????path2.lineTo(0rect().height());
????path2.lineTo(rect().width()*0.70);
????qp.fillPath(path2?QBrush(Qt::yellow));
????/**
????qp.setPen(Qt::yellow);?qp.setFont(QFont(“Arial“?28));
????qp.drawText(rc?Qt::AlignCenter?“Hello?QT“);?//顯示標題文字
????//for?(int?i?=?0;?i???????//??qp.drawPoint(i?20);?//?連續打點
????QPen?pen(Qt::red);?qp.setPen(pen);
????rc.setRect(5?40?rect().width()?-?10?rect().height()?-?45);
????qp.drawRect(rc);?//?畫矩形框
????pen.setWidth(3);?qp.setPen(pen);
????qp.drawLine(5?35?rect().width()?-?10?35);?//?畫粗線
????QBrush?brush(Qt::cyan);?qp.setBrush(brush);
????qp.setPen(Qt::NoPen);?//?關閉畫筆,?不畫邊框
????//qp.drawEllipse(rc);?//?畫青色橢
????int?r?=?rc.width()>rc.height()???rc.height()/2?:?rc.width()/2;//圓半徑
????rc.setRect(rc.center().rx()?-?r?rc.center().ry()?-?r?2?*?r?2?*?r);
????qp.setRenderHint(QPainter::Antialiasing);?//?反鋸齒平滑
????**/
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????522128??2018-12-14?15:21??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\dialog.o
?????文件?????599012??2018-12-14?15:21??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\flag
?????文件?????182480??2018-12-14?13:46??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\main.o
?????文件??????52231??2018-12-14?13:46??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\Makefile
?????文件???????2539??2018-12-14?13:46??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\moc_dialog.cpp
?????文件?????211704??2018-12-14?13:46??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\moc_dialog.o
?????文件???????1239??2018-12-14?13:52??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug\ui_dialog.h
?????文件???????1737??2018-12-14?15:21??flag\dialog.cpp
?????文件????????287??2018-12-14?13:44??flag\dialog.h
?????文件????????546??2018-12-14?13:52??flag\dialog.ui
?????文件????????345??2018-12-14?13:40??flag\flag.pro
?????文件??????18606??2018-12-14?13:40??flag\flag.pro.user
?????文件????????166??2018-12-14?13:46??flag\main.cpp
?????目錄??????????0??2018-12-14?15:21??flag\bin\build-flag-Desktop_Qt_5_5_1_GCC_32bit-Debug
?????目錄??????????0??2018-12-14?13:46??flag\bin
?????目錄??????????0??2018-12-14?15:21??flag
-----------?---------??----------?-----??----
??????????????1593020????????????????????16
評論
共有 條評論