fix form resize exception under windows

This commit is contained in:
dreamsourcelabTAI 2021-12-13 17:19:23 +08:00
parent dd11e1096c
commit 0e5fed0855
5 changed files with 28 additions and 24 deletions

View File

@ -165,12 +165,13 @@ int main(int argc, char *argv[])
}
try
{
control->Start();
{
control->Start();
// Initialise the main frame
pv::MainFrame w;
w.show();
w.readSettings();
//to show the dailog for open help document

View File

@ -228,15 +228,7 @@ bool MainFrame::eventFilter(QObject *object, QEvent *event)
if (isMaximized() || _titleBar->IsMoving()){
return QFrame::eventFilter(object, event);
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
int x0 = (int)mouse_event->globalPosition().x();
int y0 = (int)mouse_event->globalPosition().y();
#else
int x0 = mouse_event->globalX();
int y0 = mouse_event->globalY();
#endif
if (!_bDraging && type == QEvent::MouseMove && (!(mouse_event->buttons() | Qt::NoButton))){
if (object == _top_left) {
_hit_border = TopLeft;
@ -271,6 +263,15 @@ bool MainFrame::eventFilter(QObject *object, QEvent *event)
}
if (type == QEvent::MouseMove) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
int x0 = (int)mouse_event->globalPosition().x();
int y0 = (int)mouse_event->globalPosition().y();
#else
int x0 = mouse_event->globalX();
int y0 = mouse_event->globalY();
#endif
if(mouse_event->buttons().testFlag(Qt::LeftButton)) {
if (!_freezing) {
switch (_hit_border) {
@ -362,8 +363,7 @@ bool MainFrame::eventFilter(QObject *object, QEvent *event)
_dragStartGeometry = geometry();
}
else if (type == QEvent::MouseButtonRelease) {
if (mouse_event->button() == Qt::LeftButton) {
if (mouse_event->button() == Qt::LeftButton) {
_bDraging = false;
_timer.stop();
}

View File

@ -61,8 +61,7 @@
#include "data/decode/decoderstatus.h"
#include "dsvdef.h"
namespace pv {
// TODO: This should not be necessary
@ -1259,13 +1258,17 @@ void SigSession::register_hotplug_callback()
{
int ret;
ret = libusb_hotplug_register_callback(NULL, (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
(libusb_hotplug_flag)LIBUSB_HOTPLUG_ENUMERATE, 0x2A0E, LIBUSB_HOTPLUG_MATCH_ANY,
LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, NULL,
ret = libusb_hotplug_register_callback(NULL,
(libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
(libusb_hotplug_flag)LIBUSB_HOTPLUG_ENUMERATE,
0x2A0E,
LIBUSB_HOTPLUG_MATCH_ANY,
LIBUSB_HOTPLUG_MATCH_ANY,
hotplug_callback,
NULL,
&_hotplug_handle);
if (LIBUSB_SUCCESS != ret){
qDebug() << "Error creating a hotplug callback\n";
qDebug() << "Error creating a hotplug callback,code:"<<ret;
}
}

View File

@ -411,7 +411,7 @@ private:
bool _bClose;
ISessionCallback *_callback;
private:
// TODO: This should not be necessary. Multiple concurrent
// sessions should should be supported and it should be

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2021-12-13T10:43:31. -->
<!-- Written by QtCreator 4.11.0, 2021-12-13T14:10:07. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -93,7 +93,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>