//窗口渐现效果
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. 3 分钟学会调用 Apache Spark MLlib KMeans

    Apache Spark MLlib是Apache Spark体系中重要的一块拼图:提供了机器学习的模块.只是,眼下对此网上介绍的文章不是非常多.拿KMeans来说,网上有些文章提供了一些演示样例程序 ...

  2. java18 任务调度

    任务调度; Timer类, /** 了解 Timer() schedule(TimerTask task, Date time) schedule(TimerTask task, Date first ...

  3. win10系统调用架构分析

    http://blog.csdn.net/liuyez123/article/details/50992038

  4. 用Java对xml文档进行遍历,更新,创建,删除

    import java.io.File;import java.io.FileInputStream; import javax.imageio.stream.FileImageInputStream ...

  5. python--class test

    # !usr/bin/env  python3#-*- coding:utf-8 -*- 'a test class'class Student(object):    def __init__(se ...

  6. android应用版本更新功能---完整版

    源码下载地址:csdn下载地址:http://download.csdn.net/download/csdn576038874/9526085 博客园下载地址:http://files.cnblogs ...

  7. G方法的华丽升级

    ThinkPHP长期以来需要通过debug_start.debug_end方法甚至Debug类才能完成的功能,3.1版本中被一个简单的G方法取代了,不可不谓是一次华丽升级.G方法的作用包括标记位置和区 ...

  8. html 如何引入一个公共的头部和底部

    2016-01-08 作者案:尽己之力,用心打造一个商城!当你有十二分力气时,发现用了十分力气依旧没什么进展,请不要放弃希望:或许你想得到的东西正在十二分力气的地方等你:假若你用尽了十二分力气,还是没 ...

  9. JQ实现复选框的全选反选不选

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  10. 如何用eclipse搭建Android的开发环境

    l开发主要应用Eclipse 3.7版本. l辅助工具为jdk.Androidsdk Android环境搭建   –1.1.JDK安装 –1.2.Eclipse安装 –1.3.Android SDK安 ...