diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-08-19 13:29:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-20 22:12:24 +0100 |
commit | 63fb30eb29c26cd7ba0d9133610acb85cad83775 (patch) | |
tree | fb0d4870c3f2c22d14a90ad26956b8b6f45d3886 /tests/manual/highdpi/image2.qml | |
parent | 5277a60f56c83376c1f2e9d9d502f1793d8c4857 (diff) |
Implement high-dpi "@2x" image handling.
Make QQuickBaseImage::load() load "@2x" image files
on high-dpi displays. Reload images on screen change
in order to load the correct version depending on
screen dpi. Modify QQuickImageBase::updatePaintNode()
to work with @2x images.
QQuickBaseImage::load() now looks at the target
window's devicePixelRatio and checks for the presence
of a "@2x" file on disk. If found the @2x version
will be used.
Unlike QPixmap, QQuickPixmap has no special knowledge
of "@2x" files. They pixmap system will be asked to
load "@2x" files and will cache them and report the
(device) pixel size, like any other pixmap.
Add auto-test and manual test.
Task-number: QTBUG-32862, QTBUG-33069
Change-Id: I1f57a10075e499f6eee61df5421e1986521c6ab0
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'tests/manual/highdpi/image2.qml')
-rw-r--r-- | tests/manual/highdpi/image2.qml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/manual/highdpi/image2.qml b/tests/manual/highdpi/image2.qml new file mode 100644 index 0000000000..b83c8006d8 --- /dev/null +++ b/tests/manual/highdpi/image2.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 400 + + // These images should all have the same visual size: + Row { + anchors.centerIn: parent + // 1X only + Image { + source : "heart-lowdpi.png" + } + // 1X and 2x, switches on screen change. + Image { + source : "heart.png" + } + // 2x only + Image { + source : "heart-highdpi@2x.png" + } + } +} |