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相机震动效果
在一些格斗.射击以及动作类游戏中 相机震动效果是十分重要的 一个平凡的镜头 在关键时刻加入相机震动后 便可以展现出碰撞.危险.打斗以及激动人心的效果 相机震动的实现方式有很多 但都会涉及摄像机位置的变 ...
随机推荐
- 【转】GitHub删除一个仓库——2013-08-27 21
http://xiacijian.blog.163.com/blog/static/849931902012111195041170/ 1.进入要删除的仓库 2.找到 导航栏 Code NetWor ...
- Android_EditText
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...
- MongoDB 2.6.x 的安装部署
1. 下载mongodb 2.6.x版本的zip包,在D盘创建目录MongoDB,解压缩到D:\MongoDB目录. 创建数据库目录D:\MongoDB\data,接下来打开命令行窗口,切换到D:\M ...
- 20151205 jquery 学习笔记--Ajax
Ajax全称为:“Asynchronous JavaScript and XML”(异步 JavaScript 和 XML), 它并不是 JavaScript 的一种单一技术,而是利用了一系列交互式网 ...
- 序列化之Parcelable
序列化主要是用来传递类的信息,一般java有提供serializable类,这个类用的较多,不过在android上面似乎效率不高,于是google开发了针对性的优化的接口,parcelable接口. ...
- 那天有个小孩跟我说LINQ(五)转载
2 LINQ TO SQL(代码下载) 我们以一个简单的销售的业务数据库为例子 表结构很简单:Users(购买者(用户)表),Products(产品信息表),Sales(销 ...
- php常用正则表达式函数
执行一个正则表达式匹配: preg_match($pattern, $subject, [array &$matches]); 最多匹配一次,返回值0或1,把第一次匹配到的结果放入$match ...
- TPL(Task Parallel Library)多线程、并发功能
The Task Parallel Library (TPL) is a set of public types and APIs in the System.Threading and System ...
- 在 ServiceModel 客户端配置部分中,找不到引用协定“PmWs.PmWebServiceSoap”的默认终结点元素
System.Exception: ConfigManager.LoadConfigurationFromDb ServiceFactory.GetPmWebService 在 ServiceMode ...
- iOS-开发日志-UITextView介绍
UITextView 属性 1. text: 设置textView中文本 _textView.text = @"Now is the time for all good develo ...