fix: unable to complie with qt6

This commit is contained in:
dreamsource-tai 2024-07-11 15:14:28 +08:00
parent 7c53e77a13
commit c428bd66e3
5 changed files with 29 additions and 9 deletions

View File

@ -25,6 +25,7 @@
#include "../config/appconfig.h"
#include "../ui/langresource.h"
#include "../log.h"
#include "../dsvdef.h"
namespace{
QTimer *move_timer = NULL;
@ -120,7 +121,20 @@ void KeyLineEdit::wheelEvent(QWheelEvent *event)
int v = new_text.toInt();
int old_v = v;
if (event->delta() > 0){
int delta = 0;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
int anglex = event->angleDelta().x();
int angley = event->angleDelta().y();
if (anglex == 0 || ABS_VAL(angley) >= ABS_VAL(anglex)){
delta = angley;
}
#else
delta = event->delta();
#endif
if (delta > 0){
v++;
}
else{

View File

@ -28,6 +28,7 @@
#include <QWidget>
#include <QDialog>
#include <QSpinBox>
#include <QWheelEvent>
class IKeywordActive{
public:

View File

@ -1106,10 +1106,9 @@ QWidget* MainFrame::GetBodyView()
return _mainWindow->GetBodyView();
}
bool MainFrame::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
#ifdef _WIN32
bool MainFrame::nativeEvent(const QByteArray &eventType, void *message, MESSAGE_RESULT_PTR result)
{
if (_parentNativeWidget != NULL)
{
MSG *msg = static_cast<MSG*>(message);
@ -1129,10 +1128,9 @@ bool MainFrame::nativeEvent(const QByteArray &eventType, void *message, long *re
}
}
}
#endif
return QWidget::nativeEvent(eventType, message, result);
}
#endif
} // namespace pv

View File

@ -37,6 +37,13 @@
#include "toolbars/titlebar.h"
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
typedef qintptr *MESSAGE_RESULT_PTR;
#else
typedef long *MESSAGE_RESULT_PTR;
#endif
namespace pv {
class MainWindow;
@ -108,14 +115,14 @@ protected:
void resizeEvent(QResizeEvent *event);
void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *object, QEvent *event) override;
#ifdef _WIN32
void showEvent(QShowEvent *event);
bool nativeEvent(const QByteArray &eventType, void *message, MESSAGE_RESULT_PTR result) override;
#endif
void changeEvent(QEvent *event) override;
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
signals:
void sig_ParentNativeEvent(int msg);

View File

@ -1746,7 +1746,7 @@ SR_API int ds_reload_device_list()
sr_info("Reload device list.");
lib_ctx.is_reloading_list = 1;
lib_ctx.is_delay_destory_actived_device = NULL;
lib_ctx.is_delay_destory_actived_device = 0;
lib_ctx.detach_device_handle = NULL;
lib_ctx.detach_event_flag = 0;
process_attach_event(0);