中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

美女網(wǎng)站源碼策劃公司是做什么的

美女網(wǎng)站源碼,策劃公司是做什么的,網(wǎng)站建設(shè)連接數(shù)據(jù)庫,非官方網(wǎng)站建設(shè)額,忘記了哪位哲人說過:“站在巨人的肩膀上,我們能看得更高!”嗯,大概就是這個意思了。這兩天學(xué)習(xí)“一去二三里”大神博客里的Qt繪圖事件,其中有一篇涉及到畫圓盤,突然有想法,寫個簡易的抽獎小d…
  • 額,忘記了哪位哲人說過:“站在巨人的肩膀上,我們能看得更高!”嗯,大概就是這個意思了。這兩天學(xué)習(xí)“一去二三里”大神博客里的Qt繪圖事件,其中有一篇涉及到畫圓盤,突然有想法,寫個簡易的抽獎小demo。了解了這種抽獎的原理和機制后,馬丹,幸好沒有買過各種彩票之類的,各種獎項的概率值分明是設(shè)置出來的嘛(我程序里是寫死了)..好,先截個圖:

choujaing

  • 簡易能用。。哈哈
  • 頭文件代碼如下:
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QPainter>
#include <QRadialGradient>
#include <QPainterPath>
#include <QTimer>
#include <QDebug>
#include <QMouseEvent>
#include <QPushButton>
#include <QTime>
#include <QLabel>
#include <QLineEdit>
#include <QMap>
#include <QMapIterator>
#define MAX_CIRCLE  1800
namespace Ui {
class Widget;
}
class Widget : public QWidget
{Q_OBJECT
public:explicit Widget(QWidget *parent = 0);~Widget();void gradientArc(QPainter *painter,int radius,int startAngle,int angleLength,int arcHeight,QRgb color);
public slots:void updatePaint();void btnClicked();void reResult(int re);void stopRotate();
signals:void sigResult(int re);
private:Ui::Widget *ui;int m_nRotationAngle;int m_nRo;quint32 m_T;QString m_Re;QTimer *m_timer;QTimer *timer;int m_i;QPushButton *m_btn;bool isDefault;enum Awards{Spe = 3,First = 7,Second = 5,Third = 2,Luck_Fir = 6,Luck_Sec = 1,ThanK_Fir = 4,Thank_Sec = 0,};Awards m_award;QLabel *m_labTr;QLabel *m_labRe;QLineEdit *m_ldeRe;QMap<int,QString> m_map;QMap<int, QString> returnResult(int re);static QString showAwards(Awards award);void stopInit();int getRand();
protected:void paintEvent(QPaintEvent *);
};
#endif // WIDGET_H
  • 實現(xiàn)文件代碼如下:
#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);resize(600,560);setMouseTracking(true);m_nRotationAngle = 0;m_i = 0;m_T = 0;isDefault = false;m_btn = new QPushButton(this);m_btn->move(273,450);m_labTr = new QLabel(tr("抽獎結(jié)果:"),this);m_labTr->move(223,105);m_ldeRe = new QLineEdit(tr("未開始抽獎"),this);m_ldeRe->move(293,103);m_ldeRe->setEnabled(false);m_ldeRe->setAlignment(Qt::AlignCenter);m_btn->setText(tr("啟動"));m_timer = new QTimer(this);setStyleSheet("QLabel{""font-size:15px;""""}""QLineEdit{""color:white;""font-size:14px;""background-color:#f57ab8;""border:1px solid gray;""border-radius:5px;""}""QPushButton{""width:36px;""height:16px;""text-align:center;""background-color:#da0000;""color:white;""border:1px solid gray;""border-radius:3px;""}");connect(m_timer,SIGNAL(timeout()),this,SLOT(updatePaint()));connect(m_btn,SIGNAL(clicked(bool)),this,SLOT(btnClicked()));connect(this,SIGNAL(sigResult(int)),this,SLOT(reResult(int)));
}Widget::~Widget()
{delete ui;
}void Widget::gradientArc(QPainter *painter, int radius, int startAngle,int angleLength, int arcHeight, QRgb color)
{QRadialGradient gradient(0,0,radius);gradient.setColorAt(0,Qt::black);gradient.setColorAt(1.0,color);painter->setBrush(gradient);// << 1(左移1位)相當(dāng)于radius*2 即:150*2=300//QRectF(-150, -150, 300, 300)QRectF rectf(-radius,-radius,radius << 1,radius << 1);QPainterPath path;path.arcTo(rectf,startAngle,angleLength);QPainterPath subPath;subPath.addEllipse(rectf.adjusted(arcHeight, arcHeight, -arcHeight, -arcHeight));//subPath.addEllipse(rect.adjusted(arcHeight,arcHeight,-arcHeight,-arcHeight));//path為扇形 subPath為橢圓path -= subPath;////        QFont font;//        font.setFamily("Microsoft YaHei");//        font.setPointSize(14);//        painter->setPen(Qt::NoPen);//        path.addText(path.pointAtPercent(0.5), font, QStringLiteral("一去丶二三里"));painter->setPen(Qt::NoPen);painter->drawPath(path);
}void Widget::updatePaint()
{if(!isDefault){m_nRotationAngle = m_nRotationAngle + 33;if(m_nRotationAngle >360){m_nRotationAngle = 0;m_T++;if(m_T == 3){m_nRotationAngle = m_nRotationAngle + 5;}else if(m_T == 5){stopInit();}}}else{m_nRotationAngle = m_nRotationAngle + 33;if(m_nRotationAngle >360){m_nRotationAngle = 0;m_T++;if(m_T == 3){m_nRotationAngle = m_nRotationAngle + 5;}else if(m_T == 5){stopInit();}}}update();
}void Widget::btnClicked()
{if(!m_timer->isActive()){m_timer->start(30);int iRangd = getRand();emit sigResult(iRangd);m_T = 0;m_ldeRe->setStyleSheet("color:white;");m_ldeRe->setText(tr("正在抽獎..."));}else{stopInit();}
}void Widget::reResult(int re)
{isDefault = true;m_map =  returnResult(re);QMapIterator<int,QString> ii(m_map);if(m_map.isEmpty())return;while(ii.hasNext()){ii.next();m_Re = ii.value();m_nRo = ii.key();}
}void Widget::stopRotate()
{m_timer->stop();
}QMap<int,QString> Widget::returnResult(int re)
{int ire = 0;QMap<int,QString> map;switch(re){case 0://(rand()%(b-a))+ a,-->[a,b)的隨機數(shù)ire = (qrand() % (45 - 0) + 0);qDebug() << "二等獎";map.insert(ire,tr("二等獎"));break;case 1:qDebug() << "謝謝1";ire = (qrand() % (90 - 46) + 46);map.insert(ire,tr("謝謝參與"));break;case 2:qDebug() << "特等獎";ire = (qrand() % (135 - 90) + 90);map.insert(ire,tr("特等獎"));break;case 3:qDebug() << "三等獎";ire = (qrand() % (180 - 135) + 135);map.insert(ire,tr("三等獎"));break;case 4:qDebug() << "幸運2";ire = (qrand() % (225 - 180) + 180);map.insert(ire,tr("幸運獎"));break;case 5:qDebug() << "謝謝2";ire = (qrand() % (270 - 225) + 225);map.insert(ire,tr("謝謝參與"));break;case 6:qDebug() << "一等獎";ire = (qrand() % (315 - 270) + 270);map.insert(ire,tr("一等獎"));break;case 7:qDebug() << "幸運1";ire = (qrand() % (360 - 315) + 315);map.insert(ire,tr("幸運獎"));break;default:break;}return map;
}QString Widget::showAwards(Widget::Awards award)
{QString result = "";switch(award){case Spe:result = "特等獎";break;case First:result = "一等獎";break;case Second:result = "二等獎";break;case Third:result = "三等獎";break;case Luck_Fir:result = "幸運獎";break;case Luck_Sec:result = "幸運獎";break;case ThanK_Fir:result = "謝謝參與";break;case Thank_Sec:result = "謝謝參與";break;default:break;}return result;
}void Widget::stopInit()
{m_timer->stop();m_T = 0;isDefault = false;int ip =  m_nRo;int tp = m_nRotationAngle;if(ip > m_nRotationAngle){for (int i = tp; i <= ip; i++){m_nRotationAngle = i;}}m_nRotationAngle = m_nRo;m_ldeRe->setText(m_Re);update();
}//設(shè)置獎項概率
int Widget::getRand()
{int re = 10;QTime tim = QTime::currentTime();qsrand(tim.msec() + tim.second()*1000);int rand = ((qrand() % 100) + 1);qDebug() << "rand:" << rand;if(rand == 1){re = 2;}else if((rand <= 4) && (rand >= 2 )){re = 6;}else if((rand <= 9) && (rand >= 5 )){re = 0;}else if((rand <= 20) && (rand >= 10 )){re = 3;}else if((rand <= 35) && (rand >= 21 )){re = 4;}else if((rand <= 50) && (rand >= 36 )){re = 7;}else if((rand <= 75) && (rand >= 51 )){re = 1;}else if((rand <= 100) && (rand >= 76 )){re = 5;}return re;
}void Widget::paintEvent(QPaintEvent *)
{QPainter painter(this);painter.setRenderHint(QPainter::Antialiasing,true);int radius = 150;int arcHeight = 138;//>>1 右移一位,相當(dāng)于width() / 2painter.translate(width() >> 1,height() >> 1);//    painter.rotate(m_nRotationAngle);/** 參數(shù)二:半徑* 參數(shù)三:開始的角度* 參數(shù)四:指掃取的角度-順時針(360度 / 8 = 45度)* 參數(shù)五:圓環(huán)的高度* 參數(shù)六:填充色**/gradientArc(&painter,radius,0,45,arcHeight,qRgb(200,200,0));gradientArc(&painter,radius,45,45,arcHeight,qRgb(200,0,200));gradientArc(&painter,radius,90,45,arcHeight,qRgb(0,200,200));gradientArc(&painter,radius,135,45,arcHeight,qRgb(200,0,0));gradientArc(&painter,radius,225,45,arcHeight,qRgb(0,200,0));gradientArc(&painter,radius,180,45,arcHeight,qRgb(0,0,200));gradientArc(&painter,radius,270,45,arcHeight,qRgb(0,0,0));gradientArc(&painter,radius,315,45,arcHeight,qRgb(150,150,150));painter.setPen(QPen(QColor(Qt::yellow),2));painter.rotate(-35);painter.drawText(60,30,tr("謝謝參與"));painter.rotate(40);painter.drawText(70,30,tr("一等獎"));painter.rotate(95);painter.drawText(70,30,tr("二等獎"));painter.rotate(135);painter.drawText(70,30,tr("三等獎"));painter.rotate(180);painter.drawText(70,30,tr("幸運獎"));painter.rotate(210);painter.drawText(70,30,tr("幸運獎"));painter.rotate(245);painter.drawText(70,30,tr("謝謝參與"));painter.rotate(40);painter.drawText(70,30,tr("特等獎"));QPainter painter2(this);painter2.setRenderHint(QPainter::Antialiasing,true);painter2.translate(width() >> 1,height() >> 1);painter2.rotate(m_nRotationAngle);static const QPoint poit[4] = {QPoint(0,-18),QPoint(10,0),QPoint(0,60),QPoint(-10,0)};painter2.setBrush(QColor(Qt::red));painter2.setPen(Qt::NoPen);painter2.drawPolygon(poit,4);painter2.setBrush(QColor(Qt::yellow));painter2.drawEllipse(-7,-7,14,14);
}
  • 我自己寫的代碼比較爛,各位看官嘴下留情…一直想實現(xiàn)的緩動效果,就是當(dāng)針快要停下的時候緩慢的停下來。說是需要添加額外的庫。水平有限,以后有機會再慢慢實現(xiàn)。
http://www.risenshineclean.com/news/26874.html

相關(guān)文章:

  • 兩學(xué)一做網(wǎng)站 新聞有什么功能
  • 清原招聘網(wǎng)站建設(shè)成crm軟件
  • 給手機做網(wǎng)站的公司優(yōu)化設(shè)計答案五年級上冊
  • ps 做網(wǎng)站切圖線上營銷活動主要有哪些
  • 做網(wǎng)站版頭圖片網(wǎng)頁設(shè)計與制作步驟
  • 免費做外貿(mào)的網(wǎng)站平臺國內(nèi)最新新聞事件
  • 搜索網(wǎng)站不顯示圖片品牌整合營銷推廣
  • 建設(shè)維護網(wǎng)站未簽訂合同網(wǎng)絡(luò)軟文寫作
  • 群暉nas做網(wǎng)站怎么可以讓百度快速收錄視頻
  • 在web服務(wù)器做網(wǎng)站高端網(wǎng)站公司
  • 網(wǎng)站建設(shè)推廣優(yōu)化有哪些基本方法seo課程多少錢
  • 濰坊網(wǎng)站建設(shè)哪家好高端定制網(wǎng)站建設(shè)
  • 全企網(wǎng)建站怎么樣網(wǎng)站流量數(shù)據(jù)
  • 石家莊哪個公司做網(wǎng)站好百度競價代運營
  • 開發(fā)一個網(wǎng)站需要多少時間代寫文章接單平臺
  • 珠海自適應(yīng)網(wǎng)站設(shè)計做網(wǎng)站哪家好
  • 個人買域名有什么用徐州seo培訓(xùn)
  • 做網(wǎng)站需要多大的內(nèi)存品牌推廣公司
  • 學(xué)生做網(wǎng)站賺錢網(wǎng)站推廣的常用方法有哪些?
  • 厚街鎮(zhèn)網(wǎng)站仿做seo關(guān)鍵詞排名優(yōu)化制作
  • 泉州網(wǎng)站建設(shè)推廣賺錢的軟件排行
  • 名詞解釋 網(wǎng)站內(nèi)容軟文推廣文章案例
  • 國內(nèi)vps做網(wǎng)站要備案嗎太原seo排名公司
  • 淘寶網(wǎng)站的論壇做的怎么樣寧波seo托管公司
  • 國家企業(yè)信息公示官網(wǎng)入口seo推廣系統(tǒng)排名榜
  • 上海城鄉(xiāng)住房建設(shè)部網(wǎng)站首頁近期的重大新聞
  • 網(wǎng)站建設(shè)有利于優(yōu)化seo教程技術(shù)
  • 鹽城公司做網(wǎng)站自己建站的網(wǎng)站
  • 泗水做網(wǎng)站普通話的順口溜6句
  • 做網(wǎng)站開發(fā)需要的英語水平推廣賺錢軟件