//窗口渐现效果
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窗口渐现效果,窗口震动效果,鼠标移动窗口的更多相关文章

  1. jQuery实现的Div窗口震动效果实例

    本文实例讲述了jQuery实现的Div窗口震动效果.分享给大家供大家参考.具体如下: 这是一款jQuery窗口震动效果代码,在Div边框内点击一下鼠标,它就开始震动了,适用浏览器:IE8.360.Fi ...

  2. BootStrap入门教程 (四) :JQuery类库插件(模态窗口,滚动监控,标签效果,提示效果,“泡芙”效果,警告区域,折叠效果,旋转木马,输入提示)

    上讲回顾:Bootstrap组件丰富同时具有良好可扩展性,能够很好地应用在生产环境.这些组件包括按钮(Button),导航(Navigation),缩略图( thumbnails),提醒(Alert) ...

  3. 一些有用的 Emacs 配置(窗口快速切换、一键透明效果、任意位置删除整行等)

    本篇文章记录的是一些有用的 Emacs 配置,有些是自己原创,有些是借鉴别人(能记起来出处的我放了链接). 规定:C 代表 Ctrl,M 代表 Alt. 1.设置一次跳跃 n 行的快捷键 按 C-M- ...

  4. jQuery鼠标悬停文字渐隐渐现动画效果

    jQuery鼠标悬停文字渐隐渐现动画效果 当时是做项目的时候用到的所以图片有些大,九张,真正要做图片不需要这么大 css样式 <style> *{ margin: 0; padding: ...

  5. UGUI 实现界面 渐隐渐现 FadeIn/Out 效果

    孙广东  2015.7.10 事实上熟悉NGUI的人,应该知道  实现渐隐渐现 FadeIn/Out 效果是非常方便的,由于父对象 的 改变会自己主动影响到子对象. 比方 UIWidget.UIPan ...

  6. Unity3D中UGUI不使用DOTween制作渐隐渐现效果

    在做UI后期设计时,我们可能要对UI做一些特效,这篇文章我们来学习下如何在Unity3d中对实现渐隐渐现的效果, 首先我们看下Unity New UI即UGUI中渐隐渐现的做法. 观察我们会发现Uni ...

  7. 在Unity5中使用C#脚本实现UI的下滑、变色、渐隐渐现效果

    一.首先,我们先创建一个Text    依次选择Component→UI→Text创建一个Text,创建完成后如下: 二.创建完成后,在Project面板点击Create→C# Script,本例命名 ...

  8. 【温故而知新-Javascript】图片效果(图像震动效果、闪烁效果、自动切换图像)

    1.当鼠标指针经过图像时图像震动效果 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...

  9. Unity3D相机震动效果

    在一些格斗.射击以及动作类游戏中 相机震动效果是十分重要的 一个平凡的镜头 在关键时刻加入相机震动后 便可以展现出碰撞.危险.打斗以及激动人心的效果 相机震动的实现方式有很多 但都会涉及摄像机位置的变 ...

随机推荐

  1. UVALive 6088 Approximate Sorting 构造题

    题目链接:点击打开链接 题意: 给定一个n*n的01矩阵 我们跑一下例子== 4 0111 0000 0100 0110 0123 \|____ 0|0111 1|0000 2|0100 3|0110 ...

  2. linux调度器 信息解读

    http://blog.csdn.net/wudongxu/article/category/791519

  3. hdu1002大数相加

    A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...

  4. textarea限制字符数

    html代码: <div class="remark_edit J_Remark_Edit"> <div class="tip-body"&g ...

  5. Unity3D 之防止刚体碰撞导致旋转

    有时候两个刚体发生碰撞的时候,其中一个质量小的会有发生旋转的情况 如果遇到这样的情况,只需要给刚体添加一个约束就行了. 添加这个就行了.

  6. 再跟SQL谈一谈--基础篇

    1.简介 2.DDL & DML 3.SELECT ①DISTINCT ②WHERE ③AND & OR ④ORDER BY 4.INSERT 5.UPDATE 6.DELETE 1. ...

  7. Linux FTP的安装与配置(转)

    Linux FTP的安装与配置   ftp安装部分,操作步骤如下: 可以使用yum命令直接安装ftp # yum install vsftpd ftp服务的开启与关闭命令: 开启:# service  ...

  8. oracle 高版本导出低版本数据库并且导入到低版本数据的方法

    第一步:sqlplus system/egis@orcl as sysdba;  进入sqlplus (输入管理员用户名/密码@数据库密码) 第二步: create directory dumpdir ...

  9. Object-C日志记录

    在Object-C中,将日志信息输出到控制台是非常简单的.实际上NSLog()函数很像C语言里面的printf()函数,出了要用一个%@符号代表一个对象. NSLog(@"The curre ...

  10. 搭建java开发环境

    windows 去Oracle官网下载exe文件,双击安装. 修改系统环境变量(我的电脑 -> 属性 -> 高级 -> 环境变量). JAVA_HOME: D:\Java\jdk1. ...