欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Qt畫筆的簡單使用-創(chuàng)新互聯(lián)

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLinearGradient>
#include <QRadialGradient>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->resize(800, 480);
}


void MainWindow::paintEvent(QPaintEvent *event)
{
    //畫直線
    QPainter painter(this);
    painter.setPen(Qt::red); //設(shè)置畫筆為顏色
    painter.drawLine(50, 50, 600, 400); //(50, 50)為初始坐標,(600, 400)為最終坐標

    //繪制矩形  QRect為矩形類,QLinearGradient為呈線性梯度的漸變顏色類,線性漸變
//    QLinearGradient linear(rect().topLeft(), rect().bottomLeft()); //rect矩形的左上角坐標、右下角坐標,作為漸變顏色的方向
//    linear.setColorAt(0, Qt::red);
//    linear.setColorAt(0.5, Qt::green);
//    linear.setColorAt(1, Qt::blue); //設(shè)置紅、綠、藍變化
//    painter.setPen(Qt::gray); //設(shè)定畫筆顏色,到時侯就是邊框顏色
//    painter.setBrush(linear); //設(shè)置畫筆,到時候就是區(qū)域顏色
//    painter.drawRect(QRect(0, 30, this->width(), this->height()-30)); //設(shè)置繪制區(qū)域 畫矩形,左上角橫縱坐標、矩形寬度和高度

    //繪制矩形 輻射漸變
//    QRadialGradient radialGradient(310,110,100,310,110);//創(chuàng)建了一個QRadialGradient對象實例,參數(shù)分別為中心坐標,半徑長度和焦點坐標,如果需要對稱那么中心坐標和焦點坐標要一致

//    radialGradient.setColorAt(0, Qt::green);
//    //radialGradient.setColorAt(0.2,Qt::white);
//    radialGradient.setColorAt(0.4,Qt::blue);
//    //radialGradient.setColorAt(0.6,Qt::red);
//    radialGradient.setColorAt(1.0,Qt::yellow);
//    painter.setBrush(QBrush(radialGradient));
//    painter.drawEllipse(210,10,200,200);//在相應(yīng)的坐標畫出來

    //繪制矩形 弧度漸變
//    QConicalGradient conicalGradient(510,110,0);    //創(chuàng)建了一個QConicalGradient對象實例,參數(shù)分別為中心坐標和初始角度

//    conicalGradient.setColorAt(0,Qt::green);
//    conicalGradient.setColorAt(0.2,Qt::white);
//    conicalGradient.setColorAt(0.4,Qt::blue);
//    conicalGradient.setColorAt(0.6,Qt::red);
//    conicalGradient.setColorAt(0.8,Qt::yellow);
//    conicalGradient.setColorAt(1.0,Qt::green);
//    //設(shè)置漸變的顏色和路徑比例
//    painter.setBrush(QBrush(conicalGradient));
//    painter.drawEllipse(410,10,200,200);//在相應(yīng)的坐標畫出來


    //繪制折線
    painter.setPen(Qt::red);
    static const QPointF points[4] = {QPointF(0, 30), QPointF(0, this->height()-1), QPointF(this->width()-1, this->height()-1), QPointF(this->width()-1, 30)};
    painter.drawPolyline(points, 4); //由4個點連成的折線
}

MainWindow::~MainWindow()
{
    delete ui;
}

創(chuàng)新互聯(lián)主營運城網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,重慶APP軟件開發(fā),運城h5微信小程序開發(fā)搭建,運城網(wǎng)站營銷推廣歡迎運城等地區(qū)企業(yè)咨詢

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

文章題目:Qt畫筆的簡單使用-創(chuàng)新互聯(lián)
當(dāng)前地址:http://chinadenli.net/article32/hdgsc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站維護、企業(yè)網(wǎng)站制作、標簽優(yōu)化、網(wǎng)站策劃

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)