首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏跟Qt君学编程

    缩放|位移|渐变简单动画

    setWindowTitle(QStringLiteral("缩放动画@Qt君")); w->resize(320, 240); QLabel *label = new QLabel(w); /* 创建一个动画对象 */ QPropertyAnimation *animation = new QPropertyAnimation(label); /* 设置动画持续时长 */ animation->setDuration(3000); /* 设置动画目标 君")); w->resize(320, 240); QLabel *label = new QLabel(w); label->resize(100, 100); /* 创建一个动画对象 */ QPropertyAnimation *animation = new QPropertyAnimation(label); /* 设置动画目标 */ animation->setTargetObject(label); /* 设置窗口的位置作为动画参考 *animation= new QPropertyAnimation(label); /* 设置动画目标 */ animation->setTargetObject(opacityEffect);

    3.2K31发布于 2020-07-24
  • 来自专栏Linux驱动

    40.QT-QPropertyAnimationdong和QParallelAnimationGroup动画实现

    简述:QPropertyAnimation (动画类,用来向QObject对象添加动画) 该类的继承框图如下所示: ? 1.QAbstractAnimation(所有动画的抽象基类) 该抽象类为QPropertyAnimation提供了动画播放,暂停,停止,持续时间,循环周期等抽象函数. (用来向QObject对象添加动画属性) 该类的构造函数如下所示: QPropertyAnimation(QObject *target, const QByteArray &propertyName 省略其它动画初始化 CloseAnimation = new QPropertyAnimation(this,"geometry",this); CloseAnimation->setDuration //图标下浮动画 LogoDownAnimation = new QPropertyAnimation(logo,"geometry",this); LogoDownAnimation-

    1.1K40发布于 2019-05-24
  • 来自专栏Pou光明

    Qt贴图与Qss快速入门(一)

    实现动画的效果: void Dialog::initAnim() { QPropertyAnimation *m_upMainAnimation = new QPropertyAnimation *m_downMainAnimation = new QPropertyAnimation(m_bottomWidget, "pos"); m_downMainAnimation->setDuration m_upGroup->addAnimation(m_upMainAnimation); m_upGroup->addAnimation(m_downMainAnimation); QPropertyAnimation *m_upGarAnimation = new QPropertyAnimation(m_topWidget, "pos"); m_upGarAnimation->setDuration(400 *m_downGarAnimation = new QPropertyAnimation(m_bottomWidget, "pos"); m_downGarAnimation->setDuration

    1.8K30发布于 2020-04-07
  • 来自专栏Linux驱动

    58.tablewidget模拟手指实现滑动

    Pixel_per_second*0.2*(300/ms); if(moveValue > scrollV_max) { moveValue = scrollV_max; } } 最后再调用QPropertyAnimation CustomScroll_H #include <QObject> #include <QWidget> #include <QTimer> #include <QTableView> #include <QPropertyAnimation m_scrollTimer; QTimer m_selectTimer; QTableView *m_table; QScrollBar *m_scrollBar; QPropertyAnimation this); m_table->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); animation = new QPropertyAnimation

    95520发布于 2020-12-10
  • 来自专栏数据结构笔记

    PyQt动画

    widget) widget.setGeometry(QRect(0, 0, 100, 100)) # 绑定组件和属性 self.animation = QPropertyAnimation self.animation_group = QSequentialAnimationGroup() # 绑定组件和属性 # 正向 animation = QPropertyAnimation animation.start() self.animation_group.addAnimation(animation) # 反向 animation = QPropertyAnimation 这时我们可以重载 QPropertyAnimation 来实现我们的需求。 #-*- coding: utf-8 -* __author__ = 'geebos' from PyQt5.Qt import * class PropertyAnimation(QPropertyAnimation

    58810发布于 2020-04-14
  • 来自专栏全栈程序员必看

    QT 播放器之列表隐藏

    QGraphicsOpacityEffect(); m_button->setGraphicsEffect(effect); effect->setOpacity(0); m_animation = new QPropertyAnimation HIDESHOWLISTVIEW_H #include <QObject> #include <QSize> QT_BEGIN_NAMESPACE class QPushButton; class QPropertyAnimation private: int m_timerId=-1; QWidget*m_list; QPushButton *m_button; QWidget *m_parent; QPropertyAnimation QEvent> #include <QPushButton> #include <QStringLiteral> #include <QWidget> #include <QDebug> #include <QPropertyAnimation QGraphicsOpacityEffect(); m_button->setGraphicsEffect(effect); effect->setOpacity(0); m_animation = new QPropertyAnimation

    1K20编辑于 2022-09-05
  • 来自专栏繁依Fanyi 的专栏

    小白白也能学会的 PyQt 教程 —— 自定义组件 Switch Button

    import sys from PyQt5.QtCore import Qt, QPropertyAnimation, QRect, pyqtProperty, pyqtSignal from PyQt5 _switch_animation = QPropertyAnimation(self, b"switchRect", self) self. _switch_animation.setDirection(QPropertyAnimation.Forward if not self. _switch_on else QPropertyAnimation.Backward) self.

    1.7K52编辑于 2023-05-17
  • 来自专栏日常活动篇

    Qt5实战第十二篇:Qt5事件处理详解

    Qt提供了几种属性动画类,如QPropertyAnimation、QVariantAnimation、QParallelAnimationGroup和QSequentialAnimationGroup等 return a.exec();}4.mainwindow.h:#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include <QPropertyAnimation nullptr); ~MainWindow();private slots: void startAnimation();private: Ui::MainWindow *ui; QPropertyAnimation MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , animation(new QPropertyAnimation

    74710编辑于 2025-01-05
  • 来自专栏日常活动篇

    Qt5实战第五篇:图形与绘图

    动画Qt 通过 QPropertyAnimation、QSequentialAnimationGroup 和 QParallelAnimationGroup 等类支持动画效果。 示例代码:#include <QApplication>#include <QWidget>#include <QPushButton>#include <QPropertyAnimation>class QApplication app(argc, argv); AnimatedWidget widget; widget.resize(200, 200); widget.show(); QPropertyAnimation *animation = new QPropertyAnimation(&widget, "opacity"); animation->setDuration(1000); animation

    1.1K11编辑于 2024-12-28
  • 来自专栏跟Qt君学编程

    Qt官方示例-拖放机器人

    我们将首先看Robot类,以了解如何组装不同的部分,以便可以使用QPropertyAnimation分别旋转和动画化各个部分,然后我们将看ColorItem类,以演示如何在项目之间实现拖放。 QGraphicsObject通过继承QObject提供信号和槽,它还可使用Q_PROPERTY声明QGraphicsItem的属性,这使该属性可用于QPropertyAnimation。    ->setEndValue(-20); QPropertyAnimation *headScaleAnimation = new QPropertyAnimation(headItem, "scale 这两个QPropertyAnimation实例仅设置对象,属性以及各自的开始和结束值。   所有动画均由一个顶级并行动画组控制。比例和旋转动画已添加到该组中。其余动画以类似方式定义。 for (int i = 0; i < animation->animationCount(); ++i) { QPropertyAnimation *anim = qobject_cast

    5.6K41发布于 2020-02-24
  • 来自专栏Qt项目实战

    Qt编写自定义控件24-图片轮播控件

    <QWidget> class QLabel; class QHBoxLayout; class QSpacerItem; class QParallelAnimationGroup; class QPropertyAnimation QWidget *widgetNav; //存放导航指示器的容器 //动画切换 QParallelAnimationGroup *animationGroup; QPropertyAnimation *animationImage; QPropertyAnimation *animationMin; QPropertyAnimation *animationMax; private 定义动画组 animationGroup = new QParallelAnimationGroup(this); //定义动画切换图片 animationImage = new QPropertyAnimation QEasingCurve::OutCubic); animationMin->setDuration(500); //用于切换最大拉伸宽度 animationMax = new QPropertyAnimation

    2.5K10发布于 2019-08-27
  • 来自专栏码出名企路

    Qt入门系列(四)

    把继承的父亲Widget改为QPushButton,总共改了三处 在mB.cpp中添加实现: #include "mypushbutton.h"#include <QDebug>#include <QPropertyAnimation this->setIconSize(QSize(pix.width(),pix.height())); } //向上弹跳 void myPushButton::zoom1() { QPropertyAnimation *animaltion=new QPropertyAnimation(this,"geometry"); //设置动画时间间隔 animaltion->setDuration(200) QEasingCurve::OutBounce); //开始执行动画 animaltion->start(); } void myPushButton::zoom2() { QPropertyAnimation *animaltion=new QPropertyAnimation(this,"geometry"); //设置动画时间间隔 animaltion->setDuration(200)

    1.2K20编辑于 2022-06-16
  • 来自专栏独行猫a的沉淀积累总结

    Qt自定义控件之仪表盘的完整实现

    画表针 */ } 另一个的实现,文末有引用,感谢 #ifndef GAUGEPANEL_H #define GAUGEPANEL_H #include <QWidget> #include <QPropertyAnimation = QColor(100, 180, 255, 80); colorHaloEnd = QColor(30, 80, 120, 20); hShearAnimation = new QPropertyAnimation (this, "hShearValue"); vShearAnimation = new QPropertyAnimation(this, "vShearValue"); //setWindowFlags = QPropertyAnimation::Stopped){ hShearAnimation->stop(); } if(vShearAnimation->state = QPropertyAnimation::Stopped){ vShearAnimation->stop(); } hShearAnimation->setDuration

    3.2K10编辑于 2022-10-04
  • 来自专栏Linux驱动

    63.QT-重写QStackedWidget实现home界面左右滑动

    include <QWidget> #include <QStackedWidget> #include <QAbstractScrollArea> #include <QPixmap> #include <QPropertyAnimation SWITCH_NONE; QWidget *m_parent; QWidget m_smoothWidget; int m_smoothCurrentIndex=-1; QPropertyAnimation

    2.9K20发布于 2021-01-13
  • 来自专栏CSDN博客专家-小蓝枣的博客

    Python 技术篇-PyQt5动画功能演示,组件移动、尺寸改变动画演示

    PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * self.listView_Anim = QPropertyAnimation

    1.3K10发布于 2020-09-23
  • 来自专栏全栈程序员必看

    Qt 之等待提示框(QMovie)

    setScaledContents(true); m_pLoadingLabel->setMovie(pMovie); pMovie->start(); 更多参考 Qt之等待提示框(QTimer) Qt之等待提示框(QPropertyAnimation

    2.3K30编辑于 2022-07-04
  • 来自专栏Qt项目实战

    Qt编写自定义控件33-图片切换动画

    切换图片的时候可以带上动画过渡或者切换效果,显得更人性化,其实主要还是炫一些,比如百叶窗、透明度变化、左下角飞入等,无论多少种效果,核心都是围绕QPainter来进行,将各种动画效果对应的图片的区域动态计算并绘制出来,配合以QPropertyAnimation MoveBottomToLeftUpEffect = 8//图像1不动,同时图像2从右下到左上 * 2:可设置两张图片的路径名称或者图片 * 3:可设置动画因子 */ #include <QWidget> class QPropertyAnimation //图片1 QPixmap pixmap2; //图片2 AnimationType animationType; //动画效果类型 QPropertyAnimation

    2.5K00发布于 2019-08-27
  • 来自专栏Python编程 pyqt matplotlib

    PyQt5 动画类--跳舞的火柴人

    PyQt5.QtCore中的 QPropertyAnimation可以实现动画功能。 下面第一个例子通过将一个QLabel对象移动和放大来实现简单的动画: ? import sysfrom PyQt5.QtCore import QPropertyAnimation, QRect, QEasingCurvefrom PyQt5 import QtGuifrom self.label.setPixmap(pixmap) self.label.setGeometry(0, 0, 300, 300) self.animation = QPropertyAnimation _pas = [] for i in range(stickManNodeCount): pa = QtCore.QPropertyAnimation(self.m_stickMan.node

    1.8K21发布于 2019-11-14
  • 来自专栏常用算法模板

    Qt5-QtWidgets篇

    鼠标在控件上方 :pressed 该控件被按下时的状态 :disabled 该控件禁用时的状态 :first 该控件是第一个(列表中) :focus 该控件有输入焦点时 动画 QPropertyAnimation //winLabel 你要对那个组件使用动画 geometry几何结构 QPropertyAnimation * an = new QPropertyAnimation(winLabel,”geometry

    2.2K20编辑于 2022-10-31
  • 来自专栏Qt项目实战

    Qt编写自定义控件12-进度仪表盘

    进度仪表盘主要应用场景是标识一个任务进度完成的状况等,可以自由的设置范围值和当前值,为了美观还提供了四种指示器(圆形指示器/指针指示器/圆角指针指示器/三角形指示器),各种颜色都可以设置,其中的动画效果采用的QPropertyAnimation 8:支持鼠标进入和离开动画效果 * 9:可设置是否显示当前值 * 10:可设置是否显示指示器 */ #include <QWidget> #include <QVariant> class QPropertyAnimation //是否鼠标悬停 int radiusCoverCircle; //覆盖圆半径 int radiusCircle; //中间圆半径 QPropertyAnimation

    2.5K00发布于 2019-08-23
领券