From 6786d9727556f4dbf0b4cd431549dd622adabc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 3 Oct 2023 00:30:44 +0200 Subject: [PATCH] Fix compilation of 'gb.qt4' [GB.QT4] * BUG: Fix compilation of 'gb.qt4'. --- gb.qt4/share/gb.form.arrangement.h | 4 ++-- gb.qt4/src/CPicture.cpp | 2 +- gb.qt4/src/CScreen.cpp | 9 +++++++++ gb.qt4/src/CWidget.cpp | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gb.qt4/share/gb.form.arrangement.h b/gb.qt4/share/gb.form.arrangement.h index 053c9d2c7..2060d3b9f 100644 --- a/gb.qt4/share/gb.form.arrangement.h +++ b/gb.qt4/share/gb.form.arrangement.h @@ -95,7 +95,7 @@ Resizes a widget. #define MOVE_RESIZE_WIDGET(_object, _widget, _x, _y, _w, _h) Move & resize a widget simultaneously. -#define RESIZE_CONTAINER(_object, _w, _h) +#define RESIZE_CONTAINER(_object, _cont, _w, _h) Resizes the container object by resizing the widget itself. #define INIT_CHECK_CHILDREN_LIST(_widget) @@ -250,7 +250,7 @@ void FUNCTION_NAME(void *_object) //(QFrame *cont) hf = GET_WIDGET_H(cont) - hc; #endif - //fprintf(stderr, "cont: %s: %d %d %d %d (%d %d)\n", ((gControl *)_object)->name(), xc, yc, wc, hc, wf, hf); + //fprintf(stderr, "GET_WIDGET_CONTENTS: %s: %d %d %d %d\n", GET_OBJECT_NAME(_object), xc, yc, wc, hc); //if (hc > GET_WIDGET_H(cont)) // qDebug("hc = %d H = %d ?", hc, GET_WIDGET_H(cont)); diff --git a/gb.qt4/src/CPicture.cpp b/gb.qt4/src/CPicture.cpp index c34f681f9..b2a7ef74e 100644 --- a/gb.qt4/src/CPicture.cpp +++ b/gb.qt4/src/CPicture.cpp @@ -124,7 +124,7 @@ CPICTURE *CPICTURE_grab(QWidget *wid, int screen, int x, int y, int w, int h) #ifdef QT5 //*pict->pixmap = QGuiApplication::primaryScreen()->grabWindow(QX11Info::appRootWindow(), x, y, w, h); - PLATFORM.Desktop.Screenshot(pict->pixmap, x, y, w, h); + PLATFORM.Desktop.Screenshot(pict->pixmap, x, y, w, h, screen); #else *pict->pixmap = QPixmap::grabWindow(QX11Info::appRootWindow(), x, y, w, h); #endif diff --git a/gb.qt4/src/CScreen.cpp b/gb.qt4/src/CScreen.cpp index c5ff06561..a90823eb7 100644 --- a/gb.qt4/src/CScreen.cpp +++ b/gb.qt4/src/CScreen.cpp @@ -513,6 +513,13 @@ BEGIN_PROPERTY(Screen_ResolutionY) END_PROPERTY +BEGIN_METHOD(Screen_Screenshot, GB_INTEGER x; GB_INTEGER y; GB_INTEGER w; GB_INTEGER h) + + GB.ReturnObject(CPICTURE_grab(0, SCREEN->index, VARGOPT(x, 0), VARGOPT(y, 0), VARGOPT(w, 0), VARGOPT(h, 0))); + +END_METHOD + + //------------------------------------------------------------------------- GB_DESC ScreenDesc[] = @@ -534,6 +541,8 @@ GB_DESC ScreenDesc[] = GB_PROPERTY_READ("ResolutionX", "f", Screen_ResolutionX), GB_PROPERTY_READ("ResolutionY", "f", Screen_ResolutionY), + GB_METHOD("Screenshot", "Picture", Screen_Screenshot, "[(X)i(Y)i(Width)i(Height)i]"), + GB_END_DECLARE }; diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index 354967748..589843632 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -3174,14 +3174,14 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) MOUSE_delta_y %= 120; } #else - if (ev->orientation == Qt!!Horizontal) + if (ev->orientation == Qt::Horizontal) MOUSE_delta_x += ev->delta(); else MOUSE_delta_y += ev->delta(); MOUSE_info.orientation = ev->orientation(); MOUSE_info.delta = ev->delta(); cancel = GB.Raise(control, EVENT_MouseWheel, 0); - if (ev->orientation == Qt!!Horizontal) + if (ev->orientation == Qt::Horizontal) MOUSE_delta_x %= 120; else MOUSE_delta_y %= 120;