diff --git a/src/plugins/qmldesigner/designercore/designercore.pri b/src/plugins/qmldesigner/designercore/designercore.pri index 539f241c9aa..88bde4f9dec 100644 --- a/src/plugins/qmldesigner/designercore/designercore.pri +++ b/src/plugins/qmldesigner/designercore/designercore.pri @@ -36,7 +36,6 @@ SOURCES += $$PWD/model/abstractview.cpp \ $$PWD/exceptions/invalidmetainfoexception.cpp \ $$PWD/exceptions/invalidargumentexception.cpp \ $$PWD/exceptions/notimplementedexception.cpp \ - $$PWD/model/variantparser.cpp \ $$PWD/exceptions/invalidmodelstateexception.cpp \ $$PWD/exceptions/removebasestateexception.cpp \ $$PWD/exceptions/invalididexception.cpp \ @@ -107,7 +106,6 @@ HEADERS += $$PWD/include/corelib_global.h \ $$PWD/include/invalidmodelstateexception.h \ $$PWD/include/removebasestateexception.h \ $$PWD/include/invalididexception.h \ - $$PWD/model/variantparser.h \ $$PWD/include/propertynode.h \ $$PWD/include/invalidslideindexexception.h \ $$PWD/include/import.h \ diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp index 011ed135939..74fc4da5103 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp @@ -37,7 +37,6 @@ #include "metainfoparser.h" #include "iwidgetplugin.h" -#include "model/variantparser.h" #include "pluginmanager/widgetpluginmanager.h" #include diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index bbc946d7234..4b09329436a 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -51,7 +51,6 @@ #include "nodemetainfo.h" #include "model_p.h" #include "subcomponentmanager.h" -#include "variantparser.h" #include "internalproperty.h" #include "internalnodelistproperty.h" #include "internalnodeabstractproperty.h" diff --git a/src/plugins/qmldesigner/designercore/model/variantparser.cpp b/src/plugins/qmldesigner/designercore/model/variantparser.cpp deleted file mode 100644 index fba43b4ef7f..00000000000 --- a/src/plugins/qmldesigner/designercore/model/variantparser.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#include "variantparser.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace QmlDesigner { -namespace Internal { - -VariantParser::VariantParser(const QVariant &value) : m_valueType(QDeclarativeValueTypeFactory::valueType(value.type())) -{ - if (m_valueType) { - m_valueType->setValue(value); - if (!m_valueType->value().isValid()) - qWarning("VariantParser::VariantParser: value not valid"); - } -} - -VariantParser::~VariantParser() -{ - if (m_valueType) - delete m_valueType; -} - -QVariant VariantParser::value() const -{ - return m_valueType->value(); -} - -QVariant VariantParser::property(QString name) const -{ - if (!m_valueType) - return QVariant(); - return m_valueType->property(name.toLatin1()); -} - -bool VariantParser::setProperty(const QString &name, const QVariant &value) -{ - if (!m_valueType) - return false; - if (name == "pixelSize" && value.toInt() < 1) - return false; //this check we have to harcode - return m_valueType->setProperty(name.toLatin1(), value); -} - -bool VariantParser::isValueType(const QString &type) -{ - return VariantParser::create(type).isValid(); -} - -QStringList VariantParser::properties() -{ - if (!m_valueType) - return QStringList(); - QStringList propertyList; - for (int i=1; i < m_valueType->metaObject()->propertyCount(); i++) { - QMetaProperty metaProperty = m_valueType->metaObject()->property(i); - propertyList.append(metaProperty.name()); - } - return propertyList; -} - -VariantParser VariantParser::create(const QString &type) -{ - if (type == "QFont") - return VariantParser(QVariant(QFont())); - if (type == "QPoint") - return VariantParser(QVariant(QPoint())); - if (type == "QPointF") - return VariantParser(QVariant(QPointF())); - if (type == "QSize") - return VariantParser(QVariant(QSize())); - if (type == "QSizeF") - return VariantParser(QVariant(QSizeF())); - if (type == "QRect") - return VariantParser(QVariant(QRect())); - if (type == "QRectF") - return VariantParser(QVariant(QRectF())); - if (type == "QVector3D") - return VariantParser(QVariant(QVector3D())); - if (type == "QEasingCurve") - return VariantParser(QVariant(QEasingCurve())); - - return VariantParser(QVariant()); -} - -void VariantParser::init(const QString &type) -{ - if (type == "QFont") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Font); - if (type == "QPoint") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Point); - if (type == "QPointF") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::PointF); - if (type == "QSize") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Size); - if (type == "QSizeF") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::SizeF); - if (type == "QRect") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Rect); - if (type == "QRectF") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::RectF); - if (type == "QVector3D") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::Vector3D); - if (type == "QEasingCurve") - m_valueType = QDeclarativeValueTypeFactory::valueType(QVariant::EasingCurve); -} - -bool VariantParser::isValid() -{ - return m_valueType && m_valueType->value().isValid(); -} - -} // namespace Internal -} // namespace QmlDesigner - - diff --git a/src/plugins/qmldesigner/designercore/model/variantparser.h b/src/plugins/qmldesigner/designercore/model/variantparser.h deleted file mode 100644 index 34113630899..00000000000 --- a/src/plugins/qmldesigner/designercore/model/variantparser.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#ifndef QVARIANTPARSER_H -#define QVARIANTPARSER_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QDeclarativeValueType; -QT_END_NAMESPACE - -namespace QmlDesigner { -namespace Internal { - -class VariantParser -{ -public: - VariantParser(const QVariant &value); - ~VariantParser(); - QVariant value() const; - QVariant property(QString name) const; - bool setProperty(const QString &name, const QVariant &value); - bool isValid(); - QStringList properties(); - void init(const QString &type); - - static bool isValueType(const QString &type); - static VariantParser create(const QString &type); -private: - QDeclarativeValueType *m_valueType; -}; - - - -} // namespace Internal -} // namespace QmlDesigner - -#endif // QVARIANTPARSER_H