Commit ef406819 by 刘帅

悬浮窗优化,保证不会被拖到屏幕外面

parent 206f3da6
......@@ -99,7 +99,18 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
if(m_bMouseMoved)
{
// 记录坐标
ConfigManage::Instance().setFloatFormPostion(pos());
QPoint releasePoint = pos();
qDebug() << "releasePoint" <<releasePoint;
if(releasePoint.x() < 0)
releasePoint.setX(0);
if(releasePoint.y() < 0)
releasePoint.setY(0);
if(releasePoint.x() > QApplication::desktop()->screenGeometry().width() - this->width())
releasePoint.setX( QApplication::desktop()->screenGeometry().width() - this->width());
if(releasePoint.y() > QApplication::desktop()->screenGeometry().height() - this->height())
releasePoint.setY(QApplication::desktop()->screenGeometry().height() - this->height());
move(releasePoint);
ConfigManage::Instance().setFloatFormPostion(releasePoint);
}else
{
hide();
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>171</width>
<height>141</height>
<height>88</height>
</rect>
</property>
<property name="windowTitle">
......
run/skin/float_normal.png

8.17 KB | W: | H:

run/skin/float_normal.png

5.82 KB | W: | H:

run/skin/float_normal.png
run/skin/float_normal.png
run/skin/float_normal.png
run/skin/float_normal.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment