mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix: the view can't receive mouse move event after closed a popup tool menu by click caption area
This commit is contained in:
parent
9c634523c8
commit
695d84961c
@ -24,6 +24,10 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "../log.h"
|
#include "../log.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "winnativewidget.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static int _click_times = 0;
|
static int _click_times = 0;
|
||||||
@ -68,6 +72,7 @@ void XToolButton::mousePressEvent(QMouseEvent *event)
|
|||||||
setChecked(true);
|
setChecked(true);
|
||||||
QPoint pt = mapToGlobal(rect().bottomLeft());
|
QPoint pt = mapToGlobal(rect().bottomLeft());
|
||||||
connect(_menu, SIGNAL(aboutToHide()), this, SLOT(onHidePopupMenu()));
|
connect(_menu, SIGNAL(aboutToHide()), this, SLOT(onHidePopupMenu()));
|
||||||
|
pv::WinNativeWidget::EnalbeNoClientArea(false);
|
||||||
_menu->popup(pt);
|
_menu->popup(pt);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -95,6 +100,8 @@ void XToolButton::onHidePopupMenu()
|
|||||||
setChecked(false);
|
setChecked(false);
|
||||||
setCheckable(false);
|
setCheckable(false);
|
||||||
|
|
||||||
|
pv::WinNativeWidget::EnalbeNoClientArea(true);
|
||||||
|
|
||||||
QWidget *widgetUnderMouse = qApp->widgetAt(QCursor::pos());
|
QWidget *widgetUnderMouse = qApp->widgetAt(QCursor::pos());
|
||||||
if (widgetUnderMouse != this){
|
if (widgetUnderMouse != this){
|
||||||
_is_mouse_down = false;
|
_is_mouse_down = false;
|
||||||
|
@ -51,6 +51,11 @@
|
|||||||
|
|
||||||
namespace pv {
|
namespace pv {
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
bool g_enable_ncclient = true;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------WinNativeWidget
|
//-----------------------------WinNativeWidget
|
||||||
WinNativeWidget::WinNativeWidget(const int x, const int y, const int width,
|
WinNativeWidget::WinNativeWidget(const int x, const int y, const int width,
|
||||||
const int height, QColor backColor)
|
const int height, QColor backColor)
|
||||||
@ -380,6 +385,10 @@ LRESULT WinNativeWidget::hitTest(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
long x = GET_X_LPARAM(lParam);
|
long x = GET_X_LPARAM(lParam);
|
||||||
long y = GET_Y_LPARAM(lParam);
|
long y = GET_Y_LPARAM(lParam);
|
||||||
|
|
||||||
|
if (!g_enable_ncclient){
|
||||||
|
return HTCLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the size can to resize.
|
// Check if the size can to resize.
|
||||||
if (!IsMaxsized())
|
if (!IsMaxsized())
|
||||||
{
|
{
|
||||||
@ -797,4 +806,9 @@ void WinNativeWidget::setShadowStatus(int windowStatus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WinNativeWidget::EnalbeNoClientArea(bool bEnabled)
|
||||||
|
{
|
||||||
|
g_enable_ncclient = bEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,8 @@ public:
|
|||||||
|
|
||||||
void ReShowWindow();
|
void ReShowWindow();
|
||||||
|
|
||||||
|
static void EnalbeNoClientArea(bool bEnabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScreen* screenFromCurrentMonitorHandle();
|
QScreen* screenFromCurrentMonitorHandle();
|
||||||
bool isWinXOrGreater(DWORD major_version, DWORD minor_version, DWORD build_number);
|
bool isWinXOrGreater(DWORD major_version, DWORD minor_version, DWORD build_number);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user