91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-19
  • 語言: 其他
  • 標(biāo)簽: Qt界面??

資源簡介

Qt(動態(tài)數(shù)據(jù)模擬)曲線。 高端大氣上檔次,狂拽炫酷版。

資源截圖

代碼片段和文件信息

#pragma?execution_character_set(“utf-8“)

#include?“curvechart.h“
#include?“qpainter.h“
#include?“qdebug.h“

CurveChart::CurveChart(QWidget?*parent)?:?QWidget(parent)
{
????minValue?=?0;
????maxValue?=?100;
????xStep?=?10;
????yStep?=?10;

????space?=?40;
????title?=?“曲線圖“;
????showHLine?=?true;
????showPoint?=?true;
????showPointBg?=?true;

????bgColorStart?=?QColor(79?79?79);
????bgColorEnd?=?QColor(51?51?51);
????textColor?=?QColor(250?250?250);
????pointColor?=?QColor(38?114?179);
}

void?CurveChart::paintEvent(QPaintEvent?*)
{
????//繪制準(zhǔn)備工作啟用反鋸齒
????QPainter?painter(this);
????painter.setRenderHints(QPainter::Antialiasing?|?QPainter::TextAntialiasing);

????//繪制背景
????drawBg(&painter);
????//繪制盒子
????drawBox(&painter);
????//繪制文字
????drawText(&painter);
????//繪制標(biāo)題
????drawtitle(&painter);
????//繪制數(shù)據(jù)點
????drawPoint(&painter);
}

void?CurveChart::drawBg(QPainter?*painter)
{
????painter->save();
????painter->setPen(Qt::NoPen);
????QLinearGradient?topGradient(rect().topLeft()?rect().bottomLeft());
????topGradient.setColorAt(0.0?bgColorStart);
????topGradient.setColorAt(1.0?bgColorEnd);
????painter->setBrush(topGradient);
????painter->drawRect(rect());
????painter->restore();
}

void?CurveChart::drawBox(QPainter?*painter)
{
????painter->save();

????QPointF?topLeftPot(space?space);
????QPointF?bottomRightPot(width()?-?space?/?2?height()?-?space?/?2);
????painter->setPen(textColor);
????painter->setBrush(Qt::NoBrush);

????pointRect?=?QRectF(topLeftPot?bottomRightPot);
????painter->drawRect(pointRect);

????//繪制橫線
????if?(showHLine)?{
????????QPen?pen(textColor?1?Qt::DotLine);
????????painter->setPen(pen);

????????int?step?=?(maxValue?-?minValue)?/?xStep;
????????double?increment?=?(double)pointRect.height()?/?step;
????????double?startY?=?pointRect.topLeft().y();

????????for?(int?i?=?0;?i?????????????startY?+=?increment;
????????????QPointF?leftPot(pointRect.topLeft().x()?startY);
????????????QPointF?rightPot(pointRect.topRight().x()?startY);
????????????painter->drawLine(leftPot?rightPot);
????????}
????}

????painter->restore();
}

void?CurveChart::drawText(QPainter?*painter)
{
????painter->save();

????painter->setPen(textColor);
????painter->setBrush(Qt::NoBrush);

????int?step?=?(maxValue?-?minValue)?/?xStep;
????int?value?=?maxValue;
????double?increment?=?(double)pointRect.height()?/?step;
????double?startY?=?pointRect.topLeft().y();
????QString?strValue;

????for?(int?i?=?0;?i?<=?step;?i++)?{
????????strValue?=?QString(“%1“).arg(value);
????????double?textWidth?=?fontMetrics().width(strValue);
????????double?textHeight?=?fontMetrics().height();
????????QPointF?textPot(pointRect.topLeft().x()?-?5?-?textWidth?startY?+?textHeight?/?2);
????????painter->drawText(textPot?strValue);
????????value?-=?xStep;
????????startY?+=?increment;
????}

????painter->restore();
}

void?CurveChart::drawTit

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-28?17:21??curvechart\
?????文件????????8734??2017-02-07?17:31??curvechart\curvechart.cpp
?????文件????????4149??2017-02-10?17:11??curvechart\curvechart.h
?????文件?????????468??2017-02-08?09:57??curvechart\curvechart.pro
?????文件???????23877??2017-12-28?17:21??curvechart\curvechart.pro.user
?????文件????????1797??2017-01-02?14:37??curvechart\frmcurvechart.cpp
?????文件?????????631??2016-12-13?17:18??curvechart\frmcurvechart.h
?????文件????????3614??2017-01-02?15:33??curvechart\frmcurvechart.ui
?????文件?????????546??2017-02-08?09:57??curvechart\main.cpp

評論

共有 條評論