[GB.FORM]

* NEW: SliderBox: The slider has always a space for the possible minus sign.

[GB.GUI.QT]
* NEW: Print a warning message if GB_GUI contains an unsupported component.

[GB.QT5]
* NEW: Desktop.Screenshot does not use the deprecated API anymore.


git-svn-id: svn://localhost/gambas/trunk@7107 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2015-05-30 18:03:29 +00:00
parent 7d845b89a5
commit fb824c9261
6 changed files with 37 additions and 32 deletions

View File

@ -60,9 +60,9 @@ Private Sub UpdateSpinBoxWidth()
Dim N As Integer
N = Max(Abs($hSpinBox.MinValue), Abs($hSpinBox.MaxValue))
If $hSpinBox.MinValue < 0 Then N *= 10
'If $hSpinBox.MinValue < 0 Then N *= 10
$hSpinBox.W = Max(Desktop.Scale * 8, (2 + Len(CStr(N))) * $hSpinBox.Font.TextWidth("0") + Desktop.Scale * 2)
$hSpinBox.W = Max(Desktop.Scale * 8, (2 + Len(CStr(N))) * $hSpinBox.Font.TextWidth("0") + $hSpinBox.Font.TextWidth("-") + Desktop.Scale * 2)
End

View File

@ -42,10 +42,13 @@
#include "CImage.h"
#include "CPicture.h"
#ifndef NO_X_WINDOW
#ifdef QT5
#include <QScreen>
#include <QDesktopWidget>
#endif
#include <QX11Info>
#include <X11/Xlib.h>
#endif
static QHash<QByteArray, CPICTURE *> dict;
@ -131,34 +134,35 @@ static void flush_picture()
}
CPICTURE *CPICTURE_grab(QWidget *wid, int x, int y, int w, int h)
CPICTURE *CPICTURE_grab(QWidget *wid, int screen, int x, int y, int w, int h)
{
CPICTURE *pict;
int id;
CPICTURE *pict;
pict = create();
pict = create();
if (!wid)
{
#ifdef NO_X_WINDOW
qDebug("Qt/Embedded: Full screen grab not implemented");
#else
id = QX11Info::appRootWindow();
if (w <= 0 || h <= 0)
{
x = 0; y = 0; w = -1; h = -1;
}
*pict->pixmap = QPixmap::grabWindow(id, x, y, w, h);
#endif
}
else
{
*pict->pixmap = QPixmap::grabWindow(wid->winId());
}
if (!wid)
{
if (w <= 0 || h <= 0)
{
x = 0; y = 0; w = -1; h = -1;
}
#ifdef QT5
*pict->pixmap = QGuiApplication::primaryScreen()->grabWindow(QX11Info::appRootWindow(), x, y, w, h);
#else
*pict->pixmap = QPixmap::grabWindow(QX11Info::appRootWindow(), x, y, w, h);
#endif
}
else
{
#ifdef QT5
*pict->pixmap = QGuiApplication::screens().at(QApplication::desktop()->screenNumber(wid))->grabWindow(wid->winId());
#else
*pict->pixmap = QPixmap::grabWindow(wid->winId());
#endif
}
return pict;
return pict;
}

View File

@ -69,7 +69,7 @@ extern GB_DESC CPictureDesc[];
#define CLEAR_PICTURE(_store) GB.StoreObject(NULL, (void **)(void *)_store)
CPICTURE *CPICTURE_grab(QWidget *wid, int x = 0, int y = 0, int w = -1, int h = -1);
CPICTURE *CPICTURE_grab(QWidget *wid, int screen = -1, int x = 0, int y = 0, int w = -1, int h = -1);
CPICTURE *CPICTURE_get_picture(const char *path);
bool CPICTURE_load_image(QImage **p, const char *path, int lenp);
CPICTURE *CPICTURE_create(const QPixmap *pixmap);

View File

@ -132,7 +132,7 @@ END_PROPERTY
BEGIN_METHOD(Desktop_Screenshot, GB_INTEGER x; GB_INTEGER y; GB_INTEGER w; GB_INTEGER h)
GB.ReturnObject(CPICTURE_grab(0, VARGOPT(x, 0), VARGOPT(y, 0), VARGOPT(w, 0), VARGOPT(h, 0)));
GB.ReturnObject(CPICTURE_grab(0, -1, VARGOPT(x, 0), VARGOPT(y, 0), VARGOPT(w, 0), VARGOPT(h, 0)));
END_METHOD

View File

@ -3202,7 +3202,6 @@ GB_DESC CControlDesc[] =
GB_METHOD("SetFocus", NULL, Control_SetFocus, NULL),
GB_METHOD("Refresh", NULL, Control_Refresh, NULL),
//GB_METHOD("Screenshot", "Picture", Control_Screenshot, NULL),
GB_METHOD("Drag", "Control", Control_Drag, "(Data)v[(Format)s]"),
GB_METHOD("Grab", NULL, Control_Grab, NULL),

View File

@ -46,12 +46,14 @@ int EXPORT GB_INIT(void)
const char *comp2;
env = getenv("GB_GUI");
if (env)
if (env && *env)
{
if (strcmp(env, "gb.qt4") == 0)
use = USE_GB_QT4;
else if (strcmp(env, "gb.qt5") == 0)
use = USE_GB_QT5;
else
fprintf(stderr, "gb.gui: warning: '%s' component not supported\n", env);
}
if (use == USE_NOTHING)