diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-13 17:08:18 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-11 14:51:25 (GMT) |
commit | 86a160b083f9d43c07d42bbd7d2ef8b676552e38 (patch) | |
tree | cf809282c646ef327156a5ed5ae3fd4671c0e3e4 /src/gui/kernel/qgesturerecognizer.cpp | |
parent | f8c5c2720b4a48dad0f68b83d9c494185e012cd1 (diff) | |
download | Qt-86a160b083f9d43c07d42bbd7d2ef8b676552e38.zip Qt-86a160b083f9d43c07d42bbd7d2ef8b676552e38.tar.gz Qt-86a160b083f9d43c07d42bbd7d2ef8b676552e38.tar.bz2 |
Modifications after the api review by Brad.
Gesture types are now separated to internal ones, which are listed as
enums (though they might be converted to strings internally), and
third party gestures which are referenced by strings.
From now on QGesture objects derive from QObject, which means third
party gesture recognizer developers can use QObjects property system
to store custom data inside QGesture without need to subclass it.
Some functions were renamed to show their purpose more clear.
Diffstat (limited to 'src/gui/kernel/qgesturerecognizer.cpp')
-rw-r--r-- | src/gui/kernel/qgesturerecognizer.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp new file mode 100644 index 0000000..9a00138 --- /dev/null +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgesturerecognizer.h" +#include "qgesture.h" + +#include <private/qobject_p.h> +#include <private/qgesturerecognizer_p.h> + +QT_BEGIN_NAMESPACE + +QString qt_getStandardGestureTypeName(Qt::GestureType gestureType); + +QGestureRecognizerPrivate::QGestureRecognizerPrivate() + : gestureType(Qt::UnknownGesture) +{ +} + +QGestureRecognizer::QGestureRecognizer(const QString &type) + : QObject(*new QGestureRecognizerPrivate, 0) +{ + d_func()->customGestureType = type; +} + +QString QGestureRecognizer::gestureType() const +{ + Q_D(const QGestureRecognizer); + if (d->gestureType == Qt::UnknownGesture) + return d->customGestureType; + return qt_getStandardGestureTypeName(d->gestureType); +} + +QT_END_NAMESPACE |