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

  • 大小: 12KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-16
  • 語言: 其他
  • 標簽: QT??360懸浮球??

資源簡介

一個小測試程序,仿制360的懸浮球,難點在于對繪制玄的計算,其他都比較簡單,并實現拖動已經鼠標離開后的隱藏,對隱藏時做了細節處理,詳細看代碼

資源截圖

代碼片段和文件信息

#include?“fballwidget.h“
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

FBallWidget::FBallWidget(QWidget?*parent)
????:?QWidget(parent)
????m_nMemOcc(20)
{
????setWindowFlags(Qt::framelessWindowHint?|?Qt::WindowStaysOnTopHint?|?Qt::Tool);
????setAttribute(Qt::WA_TranslucentBackground);

????m_press?=?false;
????m_bg.load(“:/images/background.png“);

????QPixmap?handle;
????handle.load(“:/images/handle.png“);

????QPixmap?handlePress;
????handlePress.load(“:/images/handlePress.png“);

????m_handle?=?new?QCursor(handle?0?0);
????m_handlePress?=?new?QCursor(handlePress?0?0);
????this->setFixedSize(150?62);

????setCursor(*m_handle);

????int?screenWidth?=?QApplication::desktop()->screenGeometry().width();
????int?screenHeight?=?QApplication::desktop()->screenGeometry().height();
????this->move(screenWidth?-?42?screenHeight?*?0.618);

????connect(this?SIGNAL(notifyExitSoftSig())?this?SLOT(OnCloseSlot()));

????//動畫延遲,否則會有抖動
????m_timer?=?new?QTimer(this);
????connect(m_timer?SIGNAL(timeout())?this?SLOT(OnBallHideSlot()));

????QTimer*?timer?=?new?QTimer(this);
????connect(timer?SIGNAL(timeout())?this?SLOT(OnCountSlot()));
????timer->start(500);
}

void?FBallWidget::mousePressEvent(QMouseEvent?*event)
{
????if(event->button()?==?Qt::LeftButton)
????{
????????m_press?=?true;
????????setCursor(*m_handlePress);
????}

????m_point?=?event->globalPos()?-?pos();
}

void?FBallWidget::mouseReleaseEvent(QMouseEvent?*)
{
????setCursor(*m_handle);
????m_press?=?false;
}

void?FBallWidget::mouseMoveEvent(QMouseEvent?*event)
{
????if(m_press)
????{
????????int?screenWidth?=?QApplication::desktop()->screenGeometry().width();
????????QPoint?move_pos?=?event->globalPos();
????????QPoint?tarPos?=?move_pos?-?m_point;

????????if(tarPos.x()?+?this->width()?>?screenWidth)
????????{
????????????tarPos.setX(screenWidth?-?this->width());
????????}
????????move(tarPos);
????}
}

void?FBallWidget::mouseDoubleClickEvent(QMouseEvent?*?event)
{
}

void?FBallWidget::enterEvent(QEvent?*event)
{
????int?screenWidth?=?QApplication::desktop()->screenGeometry().width();
????if(this->geometry().x()?+?this->width()?>?screenWidth)
????{
????????QRect?rect?=?this->geometry();
????????rect.setX(screenWidth?-?this->width());

????????QPropertyAnimation?*pAnimation?=?new?QPropertyAnimation(this?“geometry“);
????????pAnimation->setStartValue(this->geometry());
????????pAnimation->setEndValue(rect);
????????pAnimation->setEasingCurve(QEasingCurve::Linear);
????????pAnimation->start(QAbstractAnimation::DeleteWhenStopped);
????}
????isHide?=?true;
????m_over?=?true;
????update();
}

void?FBallWidget::leaveEvent(QEvent?*event)
{
//????int?screenWidth?=?QApplication::desktop()->screenGeometry().width();
//????if(this->geometry().x()?+?this->width()?

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

?????文件???????9944??2018-09-09?16:13??MyFBallDemo\fballwidget.cpp

?????文件????????938??2018-09-09?15:56??MyFBallDemo\fballwidget.h

?????文件???????2798??2017-07-25?20:52??MyFBallDemo\images\background.png

?????文件???????1871??2017-07-25?20:52??MyFBallDemo\images\handle.png

?????文件???????1795??2017-07-25?20:52??MyFBallDemo\images\handlePress.png

?????文件????????240??2018-09-09?11:25??MyFBallDemo\main.cpp

?????文件????????455??2018-09-09?11:11??MyFBallDemo\MyFBallDemo.pro

?????文件??????18577??2018-09-09?11:08??MyFBallDemo\MyFBallDemo.pro.user

?????文件????????190??2018-09-09?11:23??MyFBallDemo\myfballdemo.qrc

?????文件????????201??2018-09-09?11:08??MyFBallDemo\widget.cpp

?????文件????????273??2018-09-09?11:08??MyFBallDemo\widget.h

?????文件????????441??2018-09-09?11:08??MyFBallDemo\widget.ui

?????目錄??????????0??2018-09-09?11:23??MyFBallDemo\images

?????目錄??????????0??2018-09-09?16:13??MyFBallDemo

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

????????????????37723????????????????????14


評論

共有 條評論