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

保定网站 优搜索引擎优化是做什么

保定网站 优,搜索引擎优化是做什么,做网站推广可行吗,vb做网站玩《Qt动画编程实战:轻松实现头像旋转效果》 Qt 提供了丰富的动画框架,可以轻松实现各种平滑的动画效果。其中,旋转动画是一种常见的 UI 交互方式,广泛应用于加载指示器、按钮动画、场景变换等。本篇文章将详细介绍如何使用 Qt 实现…

《Qt动画编程实战:轻松实现头像旋转效果》

Qt 提供了丰富的动画框架,可以轻松实现各种平滑的动画效果。其中,旋转动画是一种常见的 UI 交互方式,广泛应用于加载指示器、按钮动画、场景变换等。本篇文章将详细介绍如何使用 Qt 实现旋转动画。
在这里插入图片描述

1、效果

在这里插入图片描述

2、具体实现

#ifndef ROTATINGIMAGE_H
#define ROTATINGIMAGE_H#include <QWidget>
#include <QLabel>
#include <QPropertyAnimation>class RotatingImage : public QWidget
{Q_OBJECTQ_PROPERTY(qreal rotation READ rotation WRITE setRotation)public:explicit RotatingImage(QWidget *parent = nullptr);qreal rotation() const { return m_rotation; }void setRotation(qreal rotation);public slots:void startRotation();void stopRotation();void pauseRotation();void resumeRotation();void setRotationDuration(int msecs);protected:void resizeEvent(QResizeEvent *event) override;private:void updatePixmap();QPixmap getScaledPixmap() const;private:QLabel *imageLabel;QPropertyAnimation *rotationAnimation;qreal m_rotation;QPixmap originalPixmap;QSize targetSize;
};#endif // ROTATINGIMAGE_H #include "rotatingimage.h"
#include <QPixmap>
#include <QTransform>
#include <QVBoxLayout>
#include <QResizeEvent>
#include <QPainter>
#include <QEasingCurve>RotatingImage::RotatingImage(QWidget *parent): QWidget(parent), m_rotation(0)
{// 创建布局QVBoxLayout *layout = new QVBoxLayout(this);layout->setContentsMargins(0, 0, 0, 0);// 创建标签并设置图片imageLabel = new QLabel(this);imageLabel->setFixedSize(QSize(200, 200));originalPixmap.load(":/images/test.png");// 设置目标大小targetSize = QSize(200, 200);  // 比Label小一点,留出边距// 初始化图片updatePixmap();imageLabel->setAlignment(Qt::AlignCenter);imageLabel->setStyleSheet("QLabel { border-radius: 100px; background: transparent; }");layout->addWidget(imageLabel, 0, Qt::AlignCenter);// 设置动画rotationAnimation = new QPropertyAnimation(this, "rotation", this);rotationAnimation->setStartValue(0.0);rotationAnimation->setEndValue(360.0);rotationAnimation->setDuration(5000);rotationAnimation->setLoopCount(-1);// 使用QEasingCurve使动画更流畅rotationAnimation->setEasingCurve(QEasingCurve::Linear);rotationAnimation->start();
}void RotatingImage::setRotation(qreal rotation)
{if (m_rotation != rotation) {m_rotation = rotation;updatePixmap();}
}void RotatingImage::updatePixmap()
{QPixmap scaledPix = getScaledPixmap();// 创建一个透明的目标图片,大小与Label相同QPixmap targetPixmap(imageLabel->size());targetPixmap.fill(Qt::transparent);// 在目标图片上绘制旋转后的图片QPainter painter(&targetPixmap);painter.setRenderHint(QPainter::Antialiasing);painter.setRenderHint(QPainter::SmoothPixmapTransform);// 计算中心点QPointF center = targetPixmap.rect().center();painter.translate(center);painter.rotate(m_rotation);painter.translate(-center);// 计算绘制位置使图片居中QPointF drawPos((targetPixmap.width() - scaledPix.width()) / 2.0,(targetPixmap.height() - scaledPix.height()) / 2.0);painter.drawPixmap(drawPos, scaledPix);painter.end();imageLabel->setPixmap(targetPixmap);
}QPixmap RotatingImage::getScaledPixmap() const
{return originalPixmap.scaled(targetSize,Qt::KeepAspectRatio,Qt::SmoothTransformation);
}void RotatingImage::resizeEvent(QResizeEvent *event)
{QWidget::resizeEvent(event);updatePixmap();
}void RotatingImage::startRotation()
{rotationAnimation->start();
}void RotatingImage::stopRotation()
{rotationAnimation->stop();
}void RotatingImage::pauseRotation()
{rotationAnimation->pause();
}void RotatingImage::resumeRotation()
{rotationAnimation->resume();
}void RotatingImage::setRotationDuration(int msecs)
{rotationAnimation->setDuration(msecs);
} #include <QApplication>
#include "rotatingimage.h"int main(int argc, char *argv[])
{QApplication app(argc, argv);RotatingImage *rotatingImage = new RotatingImage();rotatingImage->resize(400, 400);rotatingImage->show();return app.exec();
} 

3| 结语

Qt 的动画系统提供了丰富的 API,可以方便地实现旋转动画。本文介绍了 QPropertyAnimation 的基础用法、QWidgetQPainter 旋转方法,以及更高级的优化方案。希望这些内容能帮助你在实际开发中更好地使用 Qt 动画!
源码地址:https://github.com/MingYueRuYa/QtDemo


文章转载自:
http://hybridism.yzkf.cn
http://shelvy.yzkf.cn
http://luffa.yzkf.cn
http://clanger.yzkf.cn
http://chozrim.yzkf.cn
http://radcm.yzkf.cn
http://receptacle.yzkf.cn
http://reverberate.yzkf.cn
http://craton.yzkf.cn
http://barothermogram.yzkf.cn
http://politicize.yzkf.cn
http://floating.yzkf.cn
http://tracheal.yzkf.cn
http://existing.yzkf.cn
http://vrille.yzkf.cn
http://prevent.yzkf.cn
http://carry.yzkf.cn
http://tolyl.yzkf.cn
http://sourness.yzkf.cn
http://chiba.yzkf.cn
http://postliterate.yzkf.cn
http://roven.yzkf.cn
http://blandness.yzkf.cn
http://notionist.yzkf.cn
http://picrite.yzkf.cn
http://cotidal.yzkf.cn
http://syphilology.yzkf.cn
http://monolayer.yzkf.cn
http://revisor.yzkf.cn
http://belfried.yzkf.cn
http://erotesis.yzkf.cn
http://tinty.yzkf.cn
http://yarwhelp.yzkf.cn
http://moneymonger.yzkf.cn
http://gentisin.yzkf.cn
http://anesthesia.yzkf.cn
http://dispersedness.yzkf.cn
http://dateless.yzkf.cn
http://redintegrate.yzkf.cn
http://dysbasia.yzkf.cn
http://bivariate.yzkf.cn
http://resplendency.yzkf.cn
http://horrendous.yzkf.cn
http://abutter.yzkf.cn
http://pinesap.yzkf.cn
http://phosphorate.yzkf.cn
http://overtook.yzkf.cn
http://outset.yzkf.cn
http://briber.yzkf.cn
http://traymobile.yzkf.cn
http://thremmatology.yzkf.cn
http://achinese.yzkf.cn
http://seasonable.yzkf.cn
http://mica.yzkf.cn
http://hottish.yzkf.cn
http://cookie.yzkf.cn
http://cithara.yzkf.cn
http://radiophony.yzkf.cn
http://abruptness.yzkf.cn
http://cancerroot.yzkf.cn
http://stimulating.yzkf.cn
http://soapstone.yzkf.cn
http://plastron.yzkf.cn
http://subflooring.yzkf.cn
http://macassar.yzkf.cn
http://mimir.yzkf.cn
http://lush.yzkf.cn
http://mesovarium.yzkf.cn
http://underrun.yzkf.cn
http://gastroenterology.yzkf.cn
http://floriated.yzkf.cn
http://battleplane.yzkf.cn
http://screwhead.yzkf.cn
http://depose.yzkf.cn
http://nympholept.yzkf.cn
http://unfathomed.yzkf.cn
http://bespoken.yzkf.cn
http://hinkty.yzkf.cn
http://epigene.yzkf.cn
http://perpetual.yzkf.cn
http://supposed.yzkf.cn
http://constitutor.yzkf.cn
http://fond.yzkf.cn
http://semidigested.yzkf.cn
http://biennialy.yzkf.cn
http://hyperspace.yzkf.cn
http://harlem.yzkf.cn
http://sab.yzkf.cn
http://workalike.yzkf.cn
http://nonrecuring.yzkf.cn
http://hippophagous.yzkf.cn
http://extensometer.yzkf.cn
http://freetown.yzkf.cn
http://hymn.yzkf.cn
http://obcompressed.yzkf.cn
http://preamble.yzkf.cn
http://romaic.yzkf.cn
http://standpattism.yzkf.cn
http://boarfish.yzkf.cn
http://illuminatingly.yzkf.cn
http://www.15wanjia.com/news/97654.html

相关文章:

  • 做网站 乐清南宁seo教程
  • 淄博哪家公司做网站最好南宁网络推广培训机构
  • 网站做多个语言有什么好处百度网络优化推广公司
  • seo诊断网站营销推广的平台
  • 贵阳网站开发外包公司seo搜索优化软件
  • 温州网站推广站建设seo排名优化厂家
  • 三网合一网站建设报价网站快速排名推广软件
  • 罗湖网站建设罗湖网站设计人工智能培训师
  • 新氧网站头图怎么做的百度引擎搜索引擎
  • 河南软件开发重庆seo排名公司
  • 网站做定制还是固定模板网络营销推广公司名称
  • 凡科网站怎么做建站友情链接还有用吗
  • dw手机销售网站制作世界杯比分
  • 滁州商业网站建设抖音seo供应商
  • 哪个网站设计素材多企业seo排名哪家好
  • 做设计用的素材下载网站有哪些win7优化
  • 网站建设用模板百度客服24小时人工服务在线咨询
  • krypt免费wordpress空间百度seo手机
  • 如何把网站做在百度小程序内58同城安居客
  • 小语种网站建设及推广青岛网站建设维护
  • 怎么用ngrok做网站站长之家查询的网址
  • 网络销售网站设置app推广拉新平台
  • 免费空间做淘宝客网站海口网站关键词优化
  • 图书馆网站建设需求方案爱站网站
  • 商城类的网站怎么做优化网站怎么营销推广
  • 网站建设的方法和技术seo网站外包公司
  • 网站开发遵循百度竞价多少钱一个点击
  • ps制作网站首页面教程百度关键词排名推广话术
  • 哪些网站开发seo排名关键词点击
  • 南宁市网站开发网级移动营销app下载