QT窗口渐现效果,窗口震动效果,鼠标移动窗口
//窗口渐现效果
void MainWindow::closeWindowAnimation() //关闭窗口效果
{
QPropertyAnimation *animation = new QPropertyAnimation(this,"windowOpacity");
animation->setDuration();
animation->setStartValue();
animation->setEndValue();
animation->start();
connect(animation,QPropertyAnimation::finished,this,close); }
void MainWindow::startAnimation()
{
QPropertyAnimation *animation = new QPropertyAnimation(this,"windowOpacity");
animation->setDuration();
animation->setStartValue();
animation->setEndValue();
animation->start();
}
//窗口震动效果
void MainWindow::shakeWindow()
{
QPropertyAnimation *animation = new QPropertyAnimation(this,"geometry");
animation->setDuration();
animation->setKeyValueAt(,QRect(QPoint(this->frameGeometry().x()-,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.1,QRect(QPoint(this->frameGeometry().x()+,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.2,QRect(QPoint(this->frameGeometry().x()-,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.3,QRect(QPoint(this->frameGeometry().x()+,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.4,QRect(QPoint(this->frameGeometry().x()-,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.5,QRect(QPoint(this->frameGeometry().x()+,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.6,QRect(QPoint(this->frameGeometry().x()-,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.7,QRect(QPoint(this->frameGeometry().x()+,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.8,QRect(QPoint(this->frameGeometry().x()-,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(0.9,QRect(QPoint(this->frameGeometry().x()+,this->frameGeometry().y()),this->size()));
animation->setKeyValueAt(,QRect(QPoint(this->frameGeometry().x()-,this->frameGeometry().y()),this->size()));
animation->start();
}
//鼠标移动窗口效果
void MainWindow::mousePressEvent(QMouseEvent *event)
{
if ( event->button() == Qt::LeftButton )
{
startPos = event->globalPos() - this->frameGeometry().topLeft();
qDebug()<<event->globalPos()<<this->frameGeometry().topLeft()<<startPos;
}
else if ( event->button() == Qt::MiddleButton)
closeWindowAnimation();
else if( event->button() == Qt::RightButton )
shakeWindow();
} void MainWindow::mouseMoveEvent(QMouseEvent *event)
{
if ( event->buttons() == Qt::LeftButton &&startPos.y()<)
{
endPos = event->globalPos() - startPos;
qDebug()<<endPos;
this->move(endPos); }
//qDebug()<<event->pos().x();
}
QT窗口渐现效果,窗口震动效果,鼠标移动窗口的更多相关文章
- jQuery实现的Div窗口震动效果实例
本文实例讲述了jQuery实现的Div窗口震动效果.分享给大家供大家参考.具体如下: 这是一款jQuery窗口震动效果代码,在Div边框内点击一下鼠标,它就开始震动了,适用浏览器:IE8.360.Fi ...
- BootStrap入门教程 (四) :JQuery类库插件(模态窗口,滚动监控,标签效果,提示效果,“泡芙”效果,警告区域,折叠效果,旋转木马,输入提示)
上讲回顾:Bootstrap组件丰富同时具有良好可扩展性,能够很好地应用在生产环境.这些组件包括按钮(Button),导航(Navigation),缩略图( thumbnails),提醒(Alert) ...
- 一些有用的 Emacs 配置(窗口快速切换、一键透明效果、任意位置删除整行等)
本篇文章记录的是一些有用的 Emacs 配置,有些是自己原创,有些是借鉴别人(能记起来出处的我放了链接). 规定:C 代表 Ctrl,M 代表 Alt. 1.设置一次跳跃 n 行的快捷键 按 C-M- ...
- jQuery鼠标悬停文字渐隐渐现动画效果
jQuery鼠标悬停文字渐隐渐现动画效果 当时是做项目的时候用到的所以图片有些大,九张,真正要做图片不需要这么大 css样式 <style> *{ margin: 0; padding: ...
- UGUI 实现界面 渐隐渐现 FadeIn/Out 效果
孙广东 2015.7.10 事实上熟悉NGUI的人,应该知道 实现渐隐渐现 FadeIn/Out 效果是非常方便的,由于父对象 的 改变会自己主动影响到子对象. 比方 UIWidget.UIPan ...
- Unity3D中UGUI不使用DOTween制作渐隐渐现效果
在做UI后期设计时,我们可能要对UI做一些特效,这篇文章我们来学习下如何在Unity3d中对实现渐隐渐现的效果, 首先我们看下Unity New UI即UGUI中渐隐渐现的做法. 观察我们会发现Uni ...
- 在Unity5中使用C#脚本实现UI的下滑、变色、渐隐渐现效果
一.首先,我们先创建一个Text 依次选择Component→UI→Text创建一个Text,创建完成后如下: 二.创建完成后,在Project面板点击Create→C# Script,本例命名 ...
- 【温故而知新-Javascript】图片效果(图像震动效果、闪烁效果、自动切换图像)
1.当鼠标指针经过图像时图像震动效果 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...
- Unity3D相机震动效果
在一些格斗.射击以及动作类游戏中 相机震动效果是十分重要的 一个平凡的镜头 在关键时刻加入相机震动后 便可以展现出碰撞.危险.打斗以及激动人心的效果 相机震动的实现方式有很多 但都会涉及摄像机位置的变 ...
随机推荐
- qt QSqlQuery
QT数据库QSqlQuery SQL执行操作 QSqlQuery提供了对数据库记录的Select.Insert.Update.Delete操作. SELECT操作: QSqlQuery query ...
- Cocos2D-x培训课程
1.1 Cocos2D-x 什么是cocos2d-x cocos2d-x在游戏开发中的运用 cocos2d-x的几个重要版本特点 iOS环境下搭建cocos2d开发环境 windows平台搭建coco ...
- Android(java)学习笔记161:Framework运行环境之启动SystemServer进程
SystemServer进程是zygote孵化出的第一个进程,该进程是从ZygoteInit.java的main函数中调用startSystemServer()开始的.与启动普通进程的差别 ...
- Spring MVC中如何传递对象参数
springController: @Controller @RequestMapping("/user") public UserController extends BaseC ...
- Velocity 入门(一)
Velocity是一种Java模版引擎技术,该项目由Apache提出.因为非常好用,和工作中有啥用,所以我在在理简单的入门一下. 网上找了很多教程,写的不是很明白,要么就是全部拷贝下来时候运行不起来. ...
- Linux基础1之磁盘与分区
Linux上面设备皆文件,目前需要知道的,比如U盘和SARA硬盘的在Linux上面的文件名,/dev/sd[a-p].与IDE接口不同的是,SATA/USB接口的磁盘没有一定的顺序,这里就根据Linu ...
- android中使用Intent在activity之间传递数据
android中intent传递数据的简单使用: 1.使用intent传递数据: 首先将需要传递的数据放入到intent中 Intent intent = new Intent(MainActivit ...
- 快速排序算法(C#实现)
想到了快速排序,于是自己就用C#实现了快速排序的算法: 快速排序的基本思想:分治法,即,分解,求解,组合 . 分解:在 无序区R[low..high]中任选一个记录作为基准(通常选第一个记录,并记为k ...
- 堆排序的OC实现
/* 建议先看堆调整方法,堆调整了解了,整个排序算法就算掌握了 */ - (void)viewDidLoad { [super viewDidLoad]; /* 测试数据 */ NSArray *ar ...
- swift-07-使用for-in 遍历数组
//for-in /* for 迭代变量 in集合变量 { 使用迭代变量便利所有数据 } */ //遍历数组 var arr = ["a" ,"b" ,&quo ...