1/*
2    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public
6    License as published by the Free Software Foundation; either
7    version 2 of the License, or (at your option) any later version.
8
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public License
15    along with this library; see the file COPYING.LIB.  If not, write to
16    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17    Boston, MA 02110-1301, USA.
18*/
19
20#ifndef testwindow_h
21#define testwindow_h
22
23#if 0
24#pragma qt_no_master_include
25#endif
26
27#include <QResizeEvent>
28#include <QScopedPointer>
29#include <QtQuick/qquickitem.h>
30#include <QtQuick/qquickview.h>
31
32// TestWindow: Utility class to ignore QQuickView details.
33class TestWindow : public QQuickView {
34public:
35    inline TestWindow(QQuickItem* webView);
36    QScopedPointer<QQuickItem> webView;
37
38protected:
39    inline void resizeEvent(QResizeEvent*);
40};
41
42inline TestWindow::TestWindow(QQuickItem* webView)
43    : webView(webView)
44{
45    Q_ASSERT(webView);
46    webView->setParentItem(contentItem());
47    resize(300, 400);
48}
49
50inline void TestWindow::resizeEvent(QResizeEvent* event)
51{
52    QQuickView::resizeEvent(event);
53    webView->setX(0);
54    webView->setY(0);
55    webView->setWidth(event->size().width());
56    webView->setHeight(event->size().height());
57}
58
59#endif /* testwindow_h */
60