forked from Ivasoft/DSView
Control the moving dialog in windows
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <QRect>
|
||||
|
||||
struct sr_context;
|
||||
class QWidget;
|
||||
@@ -67,6 +68,7 @@ public:
|
||||
|
||||
public:
|
||||
std::string _open_file_name;
|
||||
QRect _screenRect;
|
||||
|
||||
private:
|
||||
pv::SigSession *_session;
|
||||
|
||||
@@ -59,10 +59,6 @@ TitleBar::TitleBar(bool top, QWidget *parent, ITitleParent *titleParent, bool ha
|
||||
|
||||
assert(parent);
|
||||
|
||||
#ifdef _WIN32
|
||||
_hMonitor = NULL;
|
||||
#endif
|
||||
|
||||
setObjectName("TitleBar");
|
||||
setContentsMargins(0,0,0,0);
|
||||
setFixedHeight(32);
|
||||
@@ -264,12 +260,6 @@ void TitleBar::mouseMoveEvent(QMouseEvent *event)
|
||||
if (!_moving){
|
||||
if (ABS_VAL(datX) >= 2 || ABS_VAL(datY) >= 2){
|
||||
_moving = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
POINT cursorPos;
|
||||
GetCursorPos(&cursorPos);
|
||||
_hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
return;
|
||||
@@ -288,13 +278,17 @@ void TitleBar::mouseMoveEvent(QMouseEvent *event)
|
||||
else{
|
||||
|
||||
#ifdef _WIN32
|
||||
POINT cursorPos;
|
||||
GetCursorPos(&cursorPos);
|
||||
HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
if (hMonitor != _hMonitor){
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
QRect screenRect = AppControl::Instance()->_screenRect;
|
||||
|
||||
if (screenRect.width() > 0)
|
||||
{
|
||||
QRect rect = _parent->frameGeometry();
|
||||
if (!(rect.left() > screenRect.left() && rect.right() < screenRect.right())){
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_parent->move(x, y);
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../interface/icallbacks.h"
|
||||
#include "../ui/xtoolbutton.h"
|
||||
#include "../ui/uimanager.h"
|
||||
@@ -114,10 +110,6 @@ protected:
|
||||
ITitleParent *_titleParent;
|
||||
bool _is_done_moved;
|
||||
bool _is_able_drag;
|
||||
|
||||
#ifdef _WIN32
|
||||
HMONITOR _hMonitor;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace toolbars
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "log.h"
|
||||
#include "mainframe.h"
|
||||
#include "dsvdef.h"
|
||||
#include "appcontrol.h"
|
||||
|
||||
#define FIXED_WIDTH(widget) (widget->minimumWidth() >= widget->maximumWidth())
|
||||
#define FIXED_HEIGHT(widget) (widget->minimumHeight() >= widget->maximumHeight())
|
||||
@@ -628,7 +629,8 @@ QScreen* WinNativeWidget::screenFromCurrentMonitorHandle()
|
||||
for (QScreen *screen : QGuiApplication::screens())
|
||||
{
|
||||
if (screen->geometry().topLeft() == top_left)
|
||||
{
|
||||
{
|
||||
AppControl::Instance()->_screenRect = screen->availableGeometry();
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user