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相机震动效果
在一些格斗.射击以及动作类游戏中 相机震动效果是十分重要的 一个平凡的镜头 在关键时刻加入相机震动后 便可以展现出碰撞.危险.打斗以及激动人心的效果 相机震动的实现方式有很多 但都会涉及摄像机位置的变 ...
随机推荐
- Modify the average program to promote for intergers repeatedly.stop when a nagetive number is entere
#include<stdio.h> int main(void) { intcount ,sum,aninterger; printf("enterthe interger an ...
- 图解I/O的五种模型
1.1 五种I/O模型 1)阻塞I/O 2)非阻塞I/O 3)I/O复用 4)事件(信号)驱动I/O 5)异步I/O 1.2 为什么要发起系统调用? 因为进程想要获取磁盘中的数据,而能和磁盘打交道的只 ...
- Eclipse下使用Hadoop单机模式调试MapReduce程序
在单机模式下Hadoop不会使用HDFS,也不会开启任何Hadoop守护进程,所有程序将在一个JVM上运行并且最多只允许拥有一个reducer 在Eclipse中新创建一个hadoop-test的Ja ...
- java.sql.SQLException: Before start of result set
在使用JDBC查询数据库报了这么一个错误 CREATE TABLE `d_user` ( `id` int(10) NOT NULL, `name` varchar(10) DEFAULT NULL, ...
- String类概述
(1)多个字符组成的一串数据. 其实它可以和字符数组进行相互转换. (2)构造方法: A:public String() B:public String ...
- Unity3D 之UGUI 滑动条(Slider)
这里来讲解下UGUI 滑动条(Slider)的用法 控件下面有三个游戏对象 Background -->背景 Fill Area --> 前景区域 Handle Slide Area -- ...
- c#面向对象编程基础
1. 为什么要有面向对象? (1) 增加代码重用. (2)降低维护负担,将具备独特性质的代码封装起来,修改程序时,相互不会影响. 2.数据封装用来解决全局变量不易维护的问题. 3.多态: ...
- VS2010 测试 -普通单元测试
http://www.cnblogs.com/rhythmK/archive/2012/04/20/2458832.html
- ACM/ICPC ZOJ1006-Do the Untwist 解题代码
#include <iostream> #include <string> #include <stdlib.h> using namespace std; int ...
- ios tableview 上加 textfiled
ios tableview 上加 textfiled 首先附上我项目中用曾经用到的几张图 并说明一下我的用法: 图1: 图2: 图3: 心在你我说一下 我当初的实现 方法 ,希望能给你们一些 启 ...