当前位置: 首页 > news >正文

燃气行业网站建设方案软膜做网站有用吗

燃气行业网站建设方案,软膜做网站有用吗,网站建设工作人员有哪些职责,wordpress 底部 时间1、概述 源码放在文章末尾 该项目实现了带动画效果的多选框#xff0c;鼠标放在上面或者选中都会呈现炫酷的动画效果#xff0c;demo演示如下#xff1a; 项目部分代码如下所示#xff1a; #ifndef LINEARCHECKBOX_H #define LINEARCHECKBOX_H#include QCheckBox …1、概述 源码放在文章末尾 该项目实现了带动画效果的多选框鼠标放在上面或者选中都会呈现炫酷的动画效果demo演示如下 项目部分代码如下所示 #ifndef LINEARCHECKBOX_H #define LINEARCHECKBOX_H#include QCheckBox #include QPropertyAnimation #include QPainter #include QPainterPath #include QDebugclass AniCheckBox : public QCheckBox {Q_OBJECTQ_PROPERTY(double hover_prog READ getHoverProg WRITE setHoverProg)Q_PROPERTY(double part_prog READ getPartProg WRITE setPartProg)Q_PROPERTY(double check_prog READ getCheckProg WRITE setCheckProg) public:AniCheckBox(QWidget* parent nullptr);void setForeColor(QColor c);protected:void paintEvent(QPaintEvent *) override;void enterEvent(QEvent *e) override;void leaveEvent(QEvent *e) override;bool hitButton(const QPoint ) const override;virtual void checkStateChanged(int state);virtual void drawBox(QPainter painter, QRectF rect);QPropertyAnimation* startAnimation(const QByteArray property, double begin, double end, int duration 500, QEasingCurve curve QEasingCurve::OutQuad);protected:double getHoverProg() const;void setHoverProg(double prog);double getPartProg() const;void setPartProg(double prog);double getCheckProg() const;void setCheckProg(double prog);protected:int boxSide 0; // 选择框边长0为自适应QColor foreColor QColor(#2753ff); // 前景颜色double hoverProg 0; // 鼠标移上去的进度double partyProg 0; // 部分选中的进度double checkProg 0; // 选中的进度 };#endif // LINEARCHECKBOX_H #include anicheckbox.hAniCheckBox::AniCheckBox(QWidget *parent) : QCheckBox(parent) {setCursor(Qt::PointingHandCursor);connect(this, QCheckBox::stateChanged, this, [](int state) {// qInfo() 状态变化 static_castQt::CheckState(state);checkStateChanged(state);}); }void AniCheckBox::setForeColor(QColor c) {this-foreColor c; }void AniCheckBox::paintEvent(QPaintEvent *) {// QCheckBox::paintEvent(e);QPainter painter(this);// painter.setRenderHint(QPainter::Antialiasing, true);QRectF rect;double textLeft;if (boxSide 0){// 自适应大小优先一行文字大小其次按比例const double fixedProp 0.8; // 默认比例QFontMetricsF fm(painter.font());double side fm.height(); // 一行文字的高度if (side this-height() * fixedProp)side this-height() * fixedProp;double margin side / 2;rect QRectF(margin, (height() - side) / 2, side, side);textLeft rect.right() margin;}else{// 固定大小double margin (this-height() - boxSide) / 2;rect QRectF(margin, margin, boxSide, boxSide);textLeft rect.right() margin;}// 绘制选择框painter.save();drawBox(painter, rect);painter.restore();// 绘制文字painter.save();painter.drawText(QRectF(textLeft, 0, this-width() - textLeft, this-height()), this-text(), Qt::AlignVCenter | Qt::AlignLeft);painter.restore(); }void AniCheckBox::enterEvent(QEvent *e) {QCheckBox::enterEvent(e);startAnimation(hover_prog, getHoverProg(), 1); }void AniCheckBox::leaveEvent(QEvent *e) {QCheckBox::leaveEvent(e);startAnimation(hover_prog, getHoverProg(), 0); }bool AniCheckBox::hitButton(const QPoint ) const {return true; }void AniCheckBox::checkStateChanged(int state) {if (state Qt::Unchecked){startAnimation(check_prog, getCheckProg(), 0, 800, QEasingCurve::OutBounce);}else if (state Qt::PartiallyChecked){}else if (state Qt::Checked){startAnimation(check_prog, getCheckProg(), 1, 500, QEasingCurve::OutBack);} }void AniCheckBox::drawBox(QPainter painter, QRectF rect) {painter.setPen(foreColor);painter.setRenderHint(QPainter::Antialiasing, true);// 绘制边缘方框和悬浮状态有关double radius 3;radius * (1 - hoverProg);painter.drawRoundedRect(rect, radius, radius);// 绘制选中状态int state this-checkState();double prop 0.6;prop * checkProg;rect QRectF(rect.left() rect.width() * (1 - prop) / 2,rect.top() rect.height() * (1 - prop) / 2,rect.width() * prop,rect.height() * prop);QPainterPath path;path.addRoundedRect(rect, radius, radius);painter.fillPath(path, foreColor);if (state Qt::Unchecked){}else if (state Qt::PartiallyChecked){}else if (state Qt::Checked){} }QPropertyAnimation *AniCheckBox::startAnimation(const QByteArray property, double begin, double end, int duration, QEasingCurve curve) {QPropertyAnimation* ani new QPropertyAnimation(this, property);ani-setStartValue(begin);ani-setEndValue(end);ani-setDuration(duration);ani-setEasingCurve(curve);connect(ani, SIGNAL(finished()), ani, SLOT(deleteLater()));connect(ani, SIGNAL(valueChanged(const QVariant)), this, SLOT(update()));ani-start();return ani; }double AniCheckBox::getHoverProg() const {return hoverProg; }void AniCheckBox::setHoverProg(double prog) {this-hoverProg prog; }double AniCheckBox::getPartProg() const {return partyProg; }void AniCheckBox::setPartProg(double prog) {this-partyProg prog; }double AniCheckBox::getCheckProg() const {return checkProg; }void AniCheckBox::setCheckProg(double prog) {this-checkProg prog; } 源码下载
http://www.hkea.cn/news/14568484/

相关文章:

  • 网站怎么发布到服务器企业网站建设专业精准丨 鸣远科技
  • c 可以用来做网站吗网站群建设意义
  • 个人网站 备案 类型可以商用的电视app永久软件
  • 建设网站的市场定位常州网
  • 建设网站的风险6o2o网站开发教程
  • 建设网站需要哪些条件手机端网站尺寸规范
  • 男女直接做的视频网站wordpress源代码在哪里
  • php网站搬家软件西安做公司网站公司
  • 龙岩网站建设馨烨工信部icp备案官网
  • 山东省建设厅注册中心网站自己做网站建设
  • 班组安全建设 网站wordpress仿大众点评
  • 大麦网建设网站的功能定位中国疫苗接种率
  • 廊坊北京网站建设网络营销招聘
  • 怎么用织梦系统建一个网站南京制作网站
  • 移动网站的建设安庆怀宁网站建设兼职
  • 网站建设基本情况介绍门户网站建设多久
  • 室内设计联盟官方网站图片wordpress+大屏模版
  • 网站建设服务费是否无形资产品牌形象设计方案
  • 地产网站开发公司通州宋庄网站建设
  • 外包网站推荐wordpress网站防伪查询模板
  • 学做沪江网站要多久个人建站流程详解
  • 网站聊天室怎样做炫彩马甲wordpress代码混乱
  • 红木家具网站建设总体规划开网店被运营公司骗了怎么办
  • 高端大气网络设计建设公司网站织梦模板二级网站建设与管理会议
  • 好网站建设公司的网站礼品公司网站制作
  • 知己图书网站建设策划书云虚拟主机搭建网站
  • 可以做简单小活动的网站网站建设交流论坛地址
  • 网站开发哪便宜开发一个公司官网一般多少钱
  • 宣武做网站wordpress 制作下载
  • 网站怎么做短信营销渲模网