91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

QT 自定義無邊框窗體,支持邊緣拖拽縮放。搬運自http://www.cnblogs.com/xufeiyang/p/3313104.html,稍改了些代碼,供參考

資源截圖

代碼片段和文件信息

#include?“dialog.h“
#include?“ui_dialog.h“

Dialog::Dialog(QWidget?*parent)?:
????QDialog(parent)
????ui(new?Ui::Dialog)
{
????ui->setupUi(this);

????isLeftPressDown?=?false;
????this->dir?=?NONE;
????this->setMinimumHeight(100);
????this->setMinimumWidth(150);
????this->setWindowFlags(Qt::framelessWindowHint|Qt::WindowSystemMenuHint?);
????this->setMouseTracking(true);
????this->setstyleSheet(“QDialog{background:url(:/bg_main.png)}“);
}

Dialog::~Dialog()
{
????delete?ui;
}
void?Dialog::mouseReleaseEvent(QMouseEvent?*event)
{
????if(event->button()?==?Qt::LeftButton)?{
????????isLeftPressDown?=?false;
????????//if(dir?!=?NONE)?{
????????????this->releaseMouse();
????????????this->setCursor(QCursor(Qt::ArrowCursor));
????????//}
????}
}

void?Dialog::mousePressEvent(QMouseEvent?*event)
{
????switch(event->button())?{
????case?Qt::LeftButton:
????????isLeftPressDown?=?true;
????????if(dir?!=?NONE)?{
????????????this->mouseGrabber();
????????}?else?{
????????????dragPosition?=?event->globalPos()?-?this->frameGeometry().topLeft();
????????}
????????break;
????case?Qt::RightButton:
????????this->close();
????????break;
????default:
????????QDialog::mousePressEvent(event);
????}
}

void?Dialog::mouseMoveEvent(QMouseEvent?*event)
{
????QPoint?gloPoint?=?event->globalPos();
????QRect?rect?=?this->rect();
????QPoint?tl?=?mapToGlobal(rect.topLeft());
????QPoint?rb?=?mapToGlobal(rect.bottomRight());

????if(!isLeftPressDown)?{
????????this->region(gloPoint);
????}?else?{

????????if(dir?!=?NONE)?{
????????????QRect?rMove(tl?rb);

????????????switch(dir)?{
????????????case?LEFT:
????????????????if(rb.x()?-?gloPoint.x()?<=?this->minimumWidth())
????????????????????rMove.setX(tl.x());
????????????????else
????????????????????rMove.setX(gloPoint.x());
????????????????break;
????????????case?RIGHT:
????????????????rMove.setWidth(gloPoint.x()?-?tl.x());
????????????????break;
????????????case?UP:
????????????????if(rb.y()?-?gloPoint.y()?<=?this->minimumHeight())
????????????????????rMove.setY(tl.y());
????????????????else
????????????????????rMove.setY(gloPoint.y());
????????????????break;
????????????case?DOWN:
????????????????rMove.setHeight(gloPoint.y()?-?tl.y());
????????????????break;
????????????case?LEFTTOP:
????????????????if(rb.x()?-?gloPoint.x()?<=?this->minimumWidth())
????????????????????rMove.setX(tl.x());
????????????????else
????????????????????rMove.setX(gloPoint.x());
????????????????if(rb.y()?-?gloPoint.y()?<=?this->minimumHeight())
????????????????????rMove.setY(tl.y());
????????????????else
????????????????????rMove.setY(gloPoint.y());
????????????????break;
????????????case?RIGHTTOP:
????????????????rMove.setWidth(gloPoint.x()?-?tl.x());
????????????????if(rb.y()?-?gloPoint.y()?<=?this->minimumHeight())
????????????????????rMove.setY(tl.y());
????????????????else
????????????????????rMove.setY(gloPoint.y());
????????????????break;
???????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????1034026??2013-02-25?13:58??Sizableframe\bg_main.png

?????文件???????5724??2016-04-20?15:37??Sizableframe\dialog.cpp

?????文件????????809??2013-09-10?16:57??Sizableframe\dialog.h

?????文件????????441??2013-09-10?13:53??Sizableframe\dialog.ui

?????文件?????????90??2013-09-10?13:54??Sizableframe\image.qrc

?????文件????????179??2013-09-10?13:53??Sizableframe\main.cpp

?????文件????????413??2016-04-20?10:33??Sizableframe\Sizableframe.pro

?????文件??????34022??2016-04-20?16:49??Sizableframe\Sizableframe.pro.user

?????文件??????17738??2013-09-10?13:57??Sizableframe\Sizableframe.pro.user.3.0-pre1

?????目錄??????????0??2016-04-20?16:49??Sizableframe

-----------?---------??----------?-----??----

??????????????1093442????????????????????10


評論

共有 條評論