Originally Posted by
wysota
I used QQuickWindow::grabWindow() and my code
void getScreen::getpixel(int _x, int _y)
{
QQuickWindow screen;
QImage imageScreen
= screen.
grabWindow();
COLORREF color = imageScreen.pixel(_x,_y);
int _red = GetRValue(color);
int _green = GetGValue(color);
int _blue = GetBValue(color);
c1.setRgb(_red, _green, _blue);
qDebug() << c1.name();
}
void getScreen::getpixel(int _x, int _y)
{
QQuickWindow screen;
QImage imageScreen = screen.grabWindow();
COLORREF color = imageScreen.pixel(_x,_y);
int _red = GetRValue(color);
int _green = GetGValue(color);
int _blue = GetBValue(color);
QColor c1;
c1.setRgb(_red, _green, _blue);
qDebug() << c1.name();
}
To copy to clipboard, switch view to plain text mode
result is
QQuickWindow::grabWindow: scene graph already in use
QImage::pixel: coordinate
(39,
72) out of range
QQuickWindow::grabWindow: scene graph already in use
QImage::pixel: coordinate (39,72) out of range
To copy to clipboard, switch view to plain text mode
I don't know warning
Warning: This function can only be called from the GUI thread
Bookmarks