diff options
author | Alexandr Akulich <akulichalexander@gmail.com> | 2017-10-10 20:02:36 +0300 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-10-20 12:33:00 +0000 |
commit | e3e890dbb3106c8360d6c4a75b7905b7b1a75f09 (patch) | |
tree | 3fa7aa52c9b78c4427f32efb0de9f296ba24aa23 /tests/auto/quick/shared/geometrytestutil.cpp | |
parent | ef0953f21e79a7153f56a13aec9e7ed2865fef5c (diff) |
Extract QSizeChangeListener from tst_quickview to shared test utils
The class is useful for other tests
Change-Id: Iea287ee7659a7504800763c45ae5dc744360eaa0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/shared/geometrytestutil.cpp')
-rw-r--r-- | tests/auto/quick/shared/geometrytestutil.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/quick/shared/geometrytestutil.cpp b/tests/auto/quick/shared/geometrytestutil.cpp new file mode 100644 index 0000000000..07a755e9a5 --- /dev/null +++ b/tests/auto/quick/shared/geometrytestutil.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "geometrytestutil.h" + +#include <QQuickItem> + +QSizeChangeListener::QSizeChangeListener(QQuickItem *item) : + item(item) +{ + connect(item, &QQuickItem::widthChanged, this, &QSizeChangeListener::onSizeChanged); + connect(item, &QQuickItem::heightChanged, this, &QSizeChangeListener::onSizeChanged); +} + +void QSizeChangeListener::onSizeChanged() +{ + append(QSize(item->width(), item->height())); +} |