Fix recursion in qwidget gdiPainting test.
Change-Id: If4881dfecc6fc7cebcd3ed896846d34e35b3e3ae Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
parent
105b231214
commit
021808c670
@ -7769,13 +7769,13 @@ void tst_QWidget::moveRect()
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
class GDIWidget : public QDialog
|
class GDIWidget : public QDialog
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GDIWidget() { setAttribute(Qt::WA_PaintOnScreen); }
|
GDIWidget() { setAttribute(Qt::WA_PaintOnScreen); }
|
||||||
QPaintEngine *paintEngine() const { return 0; }
|
QPaintEngine *paintEngine() const { return 0; }
|
||||||
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *) {
|
void paintEvent(QPaintEvent *) {
|
||||||
qDebug() << __FUNCTION__;
|
|
||||||
QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
|
QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
|
||||||
const HDC hdc = (HDC)ni->nativeResourceForWindow(QByteArrayLiteral("getDC"), windowHandle());
|
const HDC hdc = (HDC)ni->nativeResourceForWindow(QByteArrayLiteral("getDC"), windowHandle());
|
||||||
if (!hdc) {
|
if (!hdc) {
|
||||||
@ -7788,15 +7788,21 @@ public:
|
|||||||
|
|
||||||
ni->nativeResourceForWindow(QByteArrayLiteral("releaseDC"), windowHandle());
|
ni->nativeResourceForWindow(QByteArrayLiteral("releaseDC"), windowHandle());
|
||||||
|
|
||||||
const QImage im = grab(QRect(QPoint(0, 0), size())).toImage();
|
QTimer::singleShot(0, this, SLOT(slotTimer()));
|
||||||
color = im.pixel(1, 1);
|
|
||||||
QTimer::singleShot(0, this, SLOT(accept()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize sizeHint() const {
|
QSize sizeHint() const {
|
||||||
return QSize(400, 300);
|
return QSize(400, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slotTimer() {
|
||||||
|
const QImage im = grab(QRect(QPoint(0, 0), size())).toImage();
|
||||||
|
color = im.pixel(1, 1);
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
QColor color;
|
QColor color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user