资源简介
详情见我的博客:http://blog.csdn.net/what951006/article/details/52831183
无bug !和windows自带效果一样!且跨平台!

代码片段和文件信息
#include “AbsframeLessAutoSize.h“
#include
AbsframeLessAutoSize::AbsframeLessAutoSize(QWidget *parent)
: QWidget(parent)
{
m_border=4;
m_state.MousePressed=false;
setMinimumSize(400550);
setMaximumSize(800700);
setMouseTracking(true);
setWindowFlags(Qt::framelessWindowHint); //setting windows tool bar icon invisiable
setSizePolicy(QSizePolicy::ExpandingQSizePolicy::Expanding);
}
void AbsframeLessAutoSize::mouseMoveRect(const QPoint& p)
{
if(!m_state.IsPressBorder)
{
if( p.x()>width()-m_border&&p.y()m_border)//right side
{
setCursor(Qt::SizeHorCursor);
m_curPos= CursorPos::Right;
}
else if(p.x()m_border)//left side;
{
setCursor(Qt::SizeHorCursor);
m_curPos= CursorPos::Left;
}
else if(p.y()>height()-m_border&&p.x()>m_border&&p.x() {
setCursor(Qt::SizeVerCursor);
m_curPos= CursorPos::Bottom;
}
else if(p.y()m_border&&p.x() {
setCursor(Qt::SizeVerCursor);
m_curPos=CursorPos::Top;
}
//corner
else if(p.y()width()-m_border)
{
setCursor(Qt::SizeBDiagCursor);
m_curPos=CursorPos::TopRight;
}
else if(p.y() {
setCursor(Qt::SizeFDiagCursor);
m_curPos=CursorPos::TopLeft;
}
else if(p.x()>m_border&&p.y()>height()-m_border)
{
setCursor(Qt::SizeFDiagCursor);
m_curPos=CursorPos::BottomRight;
}
else if(p.x()height()-m_border)
{
setCursor(Qt::SizeBDiagCursor);
m_curPos=CursorPos::BottomLeft;
}
////
else
{
setCursor(Qt::ArrowCursor);
}
}
else
{
switch (m_curPos) {
case CursorPos::Right:
{
int setW=QCursor::pos().x()-x();
if(minimumWidth()<=setW&&setW<=maximumWidth())
setGeometry(x()y()setWheight());
break;
}
case CursorPos::Left:
{
int setW=x()+width()-QCursor::pos().x();
int setX=QCursor::pos().x();
if(minimumWidth()<=setW&&setW<=maximumWidth())
setGeometry(setXy()setWheight());
break;
}
case CursorPos::Bottom:
{
int setH=QCursor::pos().y()-y();
if(minimumHeight()<=setH&&setH<=maximumHeight())
setGeometry(x()y()width()setH);
break;
}
case CursorPos::Top:
{
int setH=y()-QCursor::pos().y()+height();
if(minimumHeight()<=setH
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6952 2016-10-16 16:39 Absfr
文件 850 2016-10-16 16:39 Absfr
文件 16510464 2016-10-16 16:40 Absfr
文件 390 2016-10-16 09:10 Absfr
文件 203 2016-10-16 09:10 Absfr
目录 0 2016-10-16 16:41 Absfr
----------- --------- ---------- ----- ----
16518859 6
相关资源
- QT上位机
- qt媒体播放器
- QT5开发及源代码
- qt完整项目
- C++ mqtt 用法
- qt进度条(RoundProgressBar)
- Qt的纽带风格界面实现(Office Ribbon风
- qt 实现画板
- QT Hisi demo
- 基础qt数据库读取和显示
- Qt画图工具源码(qgraphics draw)
- Qt查询SQLite数据库
- QtWebApp
- Qt 实现心电图
- Qt实现 屏幕截图
- qt cmd实现ping
- QT实现USB摄像头拍照
- qt texteditor(富文本编辑器)
- qt 串口助手源码
- qt登录富文本编辑器和文档打印设计
- 使用QWT库实现接收串口数据,并根据
- QT SQLite封装
- QT半透明效果界面
- Qt5串口通信-windows
- 计算机远程唤醒和关机
- 使用wxWidgets进行跨平台程序开发
- QT 动态曲线
- QT视频播放器(基于FFmpeg)
- 嵌入式QtC++编程课件
- STM32连接EC20使用内置MQTT协议接入阿里
评论
共有 条评论