Commit dbfe2e7f authored by Kai Koehne's avatar Kai Koehne

QmlDesigner: Fix compilation with latest changes of QDeclarative

All files have been renamed from Qml to QDeclarative.
Registration of types is now done in an initializer method.
QmlView/QDeclarativeView doesn't have an execute method any more.
QDeclarativeMetaObject became private API.
QmlMetaProperty / QDeclarativeProperty has now different API.
parent 4c59f3f2
......@@ -41,7 +41,7 @@ class QWidget;
class QIODevice;
class QProcess;
class QPlainTextEdit;
class QmlError;
class QDeclarativeError;
QT_END_NAMESPACE
namespace QmlDesigner {
......
......@@ -33,7 +33,7 @@
#include <QtGui/QTextEdit>
#include <QtGui/QMessageBox>
#include <QmlError>
#include <QDeclarativeError>
#include <model.h>
#include "designdocumentcontroller.h"
......
......@@ -42,7 +42,7 @@
#include <QtGui/QTabWidget>
#include <QtGui/QUndoGroup>
class QmlError;
class QDeclarativeError;
namespace QmlDesigner {
......
......@@ -54,9 +54,9 @@
#include <QFileIconProvider>
#include <QImageReader>
#include <QmlView>
#include <QmlGraphicsItem>
#include <private/qmlengine_p.h>
#include <QDeclarativeView>
#include <QDeclarativeItem>
#include <private/qdeclarativeengine_p.h>
namespace QmlDesigner {
......@@ -106,7 +106,7 @@ public:
Ui::ItemLibrary m_ui;
Internal::ItemLibraryModel *m_itemLibraryModel;
QmlView *m_itemsView;
QDeclarativeView *m_itemsView;
QDirModel *m_resourcesDirModel;
QString m_resourcePath;
QSize m_itemIconSize, m_resIconSize;
......@@ -147,24 +147,23 @@ ItemLibrary::ItemLibrary(QWidget *parent) :
m_d->m_ui.ItemLibraryTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
m_d->m_ui.ItemLibraryTreeView->setRootIndex(m_d->m_resourcesDirModel->index(m_d->m_resourcePath));
m_d->m_itemsView = new QmlView(this);
m_d->m_itemsView->setSource(QUrl("qrc:/ItemLibrary/qml/ItemsView.qml"));
m_d->m_itemsView = new QDeclarativeView(this);
m_d->m_itemsView->setAttribute(Qt::WA_OpaquePaintEvent);
m_d->m_itemsView->setAttribute(Qt::WA_NoSystemBackground);
m_d->m_itemsView->setAcceptDrops(false);
m_d->m_itemsView->setFocusPolicy(Qt::ClickFocus);
m_d->m_itemsView->setResizeMode(QmlView::SizeRootObjectToView);
m_d->m_itemsView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
m_d->m_ui.ItemLibraryGridLayout->addWidget(m_d->m_itemsView, 0, 0);
m_d->m_itemLibraryModel = new Internal::ItemLibraryModel(QmlEnginePrivate::getScriptEngine(m_d->m_itemsView->engine()), this);
m_d->m_itemLibraryModel = new Internal::ItemLibraryModel(QDeclarativeEnginePrivate::getScriptEngine(m_d->m_itemsView->engine()), this);
m_d->m_itemLibraryModel->setItemIconSize(m_d->m_itemIconSize);
m_d->m_itemsView->rootContext()->setContextProperty(QLatin1String("itemLibraryModel"), m_d->m_itemLibraryModel);
m_d->m_itemsView->rootContext()->setContextProperty(QLatin1String("itemLibraryIconWidth"), m_d->m_itemIconSize.width());
m_d->m_itemsView->rootContext()->setContextProperty(QLatin1String("itemLibraryIconHeight"), m_d->m_itemIconSize.height());
m_d->m_itemsView->execute();
m_d->m_itemsView->setSource(QUrl("qrc:/ItemLibrary/qml/ItemsView.qml"));
QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(m_d->m_itemsView->rootObject());
QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(m_d->m_itemsView->rootObject());
connect(rootItem, SIGNAL(itemSelected(int)), this, SLOT(showItemInfo(int)));
connect(rootItem, SIGNAL(itemDragged(int)), this, SLOT(startDragAndDrop(int)));
connect(this, SIGNAL(expandAllItems()), rootItem, SLOT(expandAll()));
......@@ -262,7 +261,7 @@ void ItemLibrary::startDragAndDrop(int itemLibId)
drag->setPreview(QPixmap::fromImage(image));
drag->setMimeData(mimeData);
QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(m_d->m_itemsView->rootObject());
QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(m_d->m_itemsView->rootObject());
connect(rootItem, SIGNAL(stopDragAndDrop()), drag, SLOT(stopDrag()));
drag->exec();
......
......@@ -44,7 +44,7 @@ namespace Internal {
template <class T>
ItemLibrarySortedModel<T>::ItemLibrarySortedModel(QObject *parent) :
QmlListModel(parent)
QDeclarativeListModel(parent)
{
}
......@@ -230,7 +230,7 @@ ItemLibrarySectionModel::ItemLibrarySectionModel(QScriptEngine *scriptEngine, in
QScriptValue::setProperty(QLatin1String("sectionLibId"), sectionLibId);
QScriptValue::setProperty(QLatin1String("sectionName"), sectionName);
QScriptValue::setProperty(QLatin1String("sectionEntries"),
scriptEngine->newVariant(QVariant::fromValue(static_cast<QmlListModel *>(&m_sectionEntries))));
scriptEngine->newVariant(QVariant::fromValue(static_cast<QDeclarativeListModel *>(&m_sectionEntries))));
}
......
......@@ -34,7 +34,7 @@
#include <QIcon>
#include <QVariant>
#include <QScriptEngine>
#include <private/qmllistmodel_p.h>
#include <private/qdeclarativelistmodel_p.h>
QT_FORWARD_DECLARE_CLASS(QMimeData);
......@@ -46,7 +46,7 @@ class ItemLibraryInfo;
namespace Internal {
template <class T>
class ItemLibrarySortedModel: public QmlListModel {
class ItemLibrarySortedModel: public QDeclarativeListModel {
public:
ItemLibrarySortedModel(QObject *parent = 0);
~ItemLibrarySortedModel();
......
......@@ -31,7 +31,6 @@
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Bauhaus,1,0,QBoxLayout,QBoxLayoutObject);
QBoxLayoutObject::QBoxLayoutObject(QObject *parent)
: QLayoutObject(parent), _layout(0)
......@@ -57,16 +56,22 @@ void QBoxLayoutObject::clearWidget()
{
}
QML_DEFINE_TYPE(Bauhaus,1,0,QHBoxLayout,QHBoxLayoutObject);
QHBoxLayoutObject::QHBoxLayoutObject(QObject *parent)
: QBoxLayoutObject(new QHBoxLayout, parent)
{
}
QML_DEFINE_TYPE(Bauhaus,1,0,QVBoxLayout,QVBoxLayoutObject);
QVBoxLayoutObject::QVBoxLayoutObject(QObject *parent)
: QBoxLayoutObject(new QVBoxLayout, parent)
{
}
void BasicLayouts::registerDeclarativeTypes()
{
QML_REGISTER_TYPE(Bauhaus,1,0,QBoxLayout,QBoxLayoutObject);
QML_REGISTER_TYPE(Bauhaus,1,0,QHBoxLayout,QHBoxLayoutObject);
QML_REGISTER_TYPE(Bauhaus,1,0,QVBoxLayout,QVBoxLayoutObject);
}
QT_END_NAMESPACE
......@@ -43,7 +43,7 @@ class QBoxLayoutObject : public QLayoutObject
{
Q_OBJECT
Q_PROPERTY(QmlListProperty<QWidget> children READ children)
Q_PROPERTY(QDeclarativeListProperty<QWidget> children READ children)
Q_PROPERTY(int topMargin READ topMargin WRITE setTopMargin)
Q_PROPERTY(int bottomMargin READ bottomMargin WRITE setBottomMargin)
......@@ -57,8 +57,8 @@ public:
explicit QBoxLayoutObject(QBoxLayout *, QObject *parent=0);
virtual QLayout *layout() const;
QmlListProperty<QWidget> children() {
return QmlListProperty<QWidget>(this, 0, children_append, 0, 0, children_clear);
QDeclarativeListProperty<QWidget> children() {
return QDeclarativeListProperty<QWidget>(this, 0, children_append, 0, 0, children_clear);
}
private:
......@@ -66,11 +66,11 @@ private:
void addWidget(QWidget *);
void clearWidget();
static void children_append(QmlListProperty<QWidget> *property, QWidget *widget) {
static void children_append(QDeclarativeListProperty<QWidget> *property, QWidget *widget) {
static_cast<QBoxLayoutObject*>(property->object)->addWidget(widget);
}
static void children_clear(QmlListProperty<QWidget> *property) {
static void children_clear(QDeclarativeListProperty<QWidget> *property) {
static_cast<QBoxLayoutObject*>(property->object)->clearWidget();
}
......@@ -172,6 +172,12 @@ QML_DECLARE_TYPE(QBoxLayoutObject);
QML_DECLARE_TYPE(QHBoxLayoutObject);
QML_DECLARE_TYPE(QVBoxLayoutObject);
class BasicLayouts {
public:
static void registerDeclarativeTypes();
};
QT_END_HEADER
#endif // BASICLAYOUTS_H
......@@ -30,7 +30,7 @@
#ifndef BASICWIDGETS_H
#define BASICWIDGETS_H
#include <qml.h>
#include <qdeclarative.h>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QLabel>
......@@ -94,6 +94,7 @@ QML_DECLARE_TYPE(QTabWidget);
QML_DECLARE_TYPE(FileWidget);
QML_DECLARE_TYPE(LayoutWidget);
class Action : public QAction {
Q_OBJECT
public:
......@@ -111,5 +112,9 @@ QML_DECLARE_TYPE(Action);
//QML_DECLARE_TYPE(QTableView);
//top-level windows?
class BasicWidgets {
public:
static void registerDeclarativeTypes();
};
#endif // BASICWIDGETS_H
......@@ -39,10 +39,12 @@
#include <QSpinBox>
QML_DEFINE_TYPE(Bauhaus,1,0,BehaviorWidget,QmlDesigner::BehaviorWidget);
namespace QmlDesigner {
void BehaviorDialog::registerDeclarativeType()
{
QML_REGISTER_TYPE(Bauhaus,1,0,BehaviorWidget,QmlDesigner::BehaviorWidget);
}
BehaviorWidget::BehaviorWidget() : QPushButton(), m_BehaviorDialog(new BehaviorDialog(0))
{
......
......@@ -37,7 +37,7 @@
#include <QDialog>
#include <QWeakPointer>
#include <QScopedPointer>
#include <qml.h>
#include <qdeclarative.h>
#include "ui_behaviordialog.h"
......@@ -83,6 +83,7 @@ public slots:
virtual void accept();
virtual void reject();
static void registerDeclarativeType();
private:
ModelNode m_modelNode;
......
......@@ -41,13 +41,14 @@
#include <variantproperty.h>
#include <qmlobjectnode.h>
QML_DEFINE_TYPE(Bauhaus,1,0,ColorButton,QmlDesigner::ColorButton);
QML_DEFINE_TYPE(Bauhaus,1,0,HueControl,QmlDesigner::HueControl);
QML_DEFINE_TYPE(Bauhaus,1,0,ColorBox,QmlDesigner::ColorBox);
namespace QmlDesigner {
void ColorWidget::registerDeclarativeTypes() {
QML_REGISTER_TYPE(Bauhaus,1,0,ColorButton,QmlDesigner::ColorButton);
QML_REGISTER_TYPE(Bauhaus,1,0,HueControl,QmlDesigner::HueControl);
QML_REGISTER_TYPE(Bauhaus,1,0,ColorBox,QmlDesigner::ColorBox);
}
void ColorButton::paintEvent(QPaintEvent *event)
{
QToolButton::paintEvent(event);
......
......@@ -36,7 +36,7 @@
#include <QToolButton>
#include <QMouseEvent>
#include <modelnode.h>
#include <qml.h>
#include <qdeclarative.h>
#include <propertyeditorvalue.h>
QT_BEGIN_NAMESPACE
......@@ -282,6 +282,12 @@ private:
};
class ColorWidget {
public:
static void registerDeclarativeTypes();
};
} //QmlDesigner
QML_DECLARE_TYPE(QmlDesigner::ColorButton);
......
......@@ -36,8 +36,6 @@
#include <QComboBox>
#include <QLabel>
QML_DEFINE_TYPE(Bauhaus,1,0,FontWidget,QmlDesigner::FontWidget);
namespace QmlDesigner {
FontWidget::FontWidget(QWidget *parent)
......@@ -169,4 +167,8 @@ void FontWidget::setFontSize(qreal size)
}
}
void FontWidget::registerDeclarativeTypes() {
QML_REGISTER_TYPE(Bauhaus,1,0,FontWidget,QmlDesigner::FontWidget);
}
} // namespace QmlDesigner
......@@ -32,7 +32,7 @@
#include <QWeakPointer>
#include <QWidget>
#include <qml.h>
#include <qdeclarative.h>
QT_BEGIN_NAMESPACE
......@@ -75,6 +75,8 @@ public:
QFont font() const;
void setFont(QFont size);
static void registerDeclarativeTypes();
signals:
void familyChanged();
void boldChanged();
......
......@@ -31,9 +31,9 @@
#define QmlPropertyView_h
#include <qmlmodelview.h>
#include <QmlView>
#include <QDeclarativeView>
#include <QHash>
#include <QmlPropertyMap>
#include <QDeclarativePropertyMap>
#include "qmlanchorbindingproxy.h"
......@@ -50,16 +50,16 @@ class PropertyEditor: public QmlModelView
class NodeType {
public:
NodeType(const QUrl &qmlFile, PropertyEditor *propertyEditor);
NodeType(PropertyEditor *propertyEditor);
~NodeType();
void setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
void initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
QmlView *m_view;
QDeclarativeView *m_view;
Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
QmlPropertyMap m_backendValuesPropertyMap;
QDeclarativePropertyMap m_backendValuesPropertyMap;
};
public:
......
......@@ -38,11 +38,6 @@
#include <nodeproperty.h>
#include <qmlobjectnode.h>
QML_DEFINE_TYPE(Bauhaus,1,0,PropertyEditorValue,PropertyEditorValue)
QML_DEFINE_TYPE(Bauhaus,1,0,PropertyEditorNodeWrapper,PropertyEditorNodeWrapper)
QML_DEFINE_TYPE(Bauhaus,1,0,QmlPropertyMap,QmlPropertyMap)
//using namespace QmlDesigner;
PropertyEditorValue::PropertyEditorValue(QObject *parent)
......@@ -209,6 +204,13 @@ void PropertyEditorValue::unlock()
m_rewriterTransaction.commit();
}
void PropertyEditorValue::registerDeclarativeTypes()
{
QML_REGISTER_TYPE(Bauhaus,1,0,PropertyEditorValue,PropertyEditorValue);
QML_REGISTER_TYPE(Bauhaus,1,0,PropertyEditorNodeWrapper,PropertyEditorNodeWrapper);
QML_REGISTER_TYPE(Bauhaus,1,0,QDeclarativePropertyMap,QDeclarativePropertyMap);
}
PropertyEditorNodeWrapper::PropertyEditorNodeWrapper(PropertyEditorValue* parent) : m_valuesPropertyMap(this)
{
m_editorValue = parent;
......@@ -246,7 +248,7 @@ QString PropertyEditorNodeWrapper::propertyName() const
return m_editorValue->name();
}
QmlPropertyMap* PropertyEditorNodeWrapper::properties()
QDeclarativePropertyMap* PropertyEditorNodeWrapper::properties()
{
return &m_valuesPropertyMap;
}
......@@ -344,3 +346,4 @@ void PropertyEditorNodeWrapper::update()
emit typeChanged();
}
}
......@@ -31,8 +31,8 @@
#define PROPERTYEDITORVALUE_H
#include <QObject>
#include <QmlPropertyMap>
#include <qml.h>
#include <QDeclarativePropertyMap>
#include <qdeclarative.h>
#include <modelnode.h>
#include <rewritertransaction.h>
......@@ -45,7 +45,7 @@ class PropertyEditorNodeWrapper : public QObject {
Q_OBJECT
Q_PROPERTY(bool exists READ exists NOTIFY existsChanged)
Q_PROPERTY(QmlPropertyMap* properties READ properties NOTIFY propertiesChanged)
Q_PROPERTY(QDeclarativePropertyMap* properties READ properties NOTIFY propertiesChanged)
Q_PROPERTY(QString type READ type NOTIFY typeChanged)
public:
......@@ -53,7 +53,7 @@ public:
PropertyEditorNodeWrapper(PropertyEditorValue* parent);
bool exists();
QString type();
QmlPropertyMap* properties();
QDeclarativePropertyMap* properties();
ModelNode parentModelNode() const;
QString propertyName() const;
......@@ -72,7 +72,7 @@ private:
void setup();
QmlDesigner::ModelNode m_modelNode;
QmlPropertyMap m_valuesPropertyMap;
QDeclarativePropertyMap m_valuesPropertyMap;
PropertyEditorValue* m_editorValue;
};
......@@ -117,6 +117,8 @@ public:
PropertyEditorNodeWrapper* complexNode();
static void registerDeclarativeTypes();
public slots:
void resetValue();
void lock();
......@@ -148,6 +150,6 @@ private: //variables
QML_DECLARE_TYPE(PropertyEditorValue);
QML_DECLARE_TYPE(PropertyEditorNodeWrapper);
QML_DECLARE_TYPE(QmlPropertyMap);
QML_DECLARE_TYPE(QDeclarativePropertyMap);
#endif // PROPERTYEDITORVALUE_H
......@@ -31,7 +31,11 @@
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,QLayoutObject,QLayoutObject);
void QLayoutObject::registerDeclarativeType()
{
QML_REGISTER_TYPE(Qt,4,6,QLayoutObject,QLayoutObject);
}
QLayoutObject::QLayoutObject(QObject *parent)
: QObject(parent)
......
......@@ -32,7 +32,7 @@
#include <QObject>
#include <QLayout>
#include <qml.h>
#include <qdeclarative.h>
QT_BEGIN_HEADER
......@@ -47,6 +47,8 @@ public:
QLayoutObject(QObject *parent = 0);
virtual QLayout *layout() const;
static void registerDeclarativeType();
};
QT_END_NAMESPACE
......
......@@ -32,8 +32,6 @@
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,LayoutItem,QProxyLayoutItem);
QProxyLayoutItem::QProxyLayoutItem(QGraphicsLayoutItem *i)
: enabled(true), other(i)
{
......@@ -90,8 +88,6 @@ QSizeF QProxyLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF &c) const
return rv;
}
QML_DEFINE_TYPE(Qt,4,6,ProxyLayout,QProxyLayout);
QProxyLayout::QProxyLayout(QObject *parent)
: QObject(parent), proxy(0)
{
......@@ -162,4 +158,10 @@ QSizeF QProxyLayout::sizeHint(Qt::SizeHint which,
return QSizeF();
}
void QProxyLayoutItem::registerDeclarativeTypes()
{
QML_REGISTER_TYPE(Qt,4,6,LayoutItem,QProxyLayoutItem);
QML_REGISTER_TYPE(Qt,4,6,ProxyLayout,QProxyLayout);
}
QT_END_NAMESPACE
......@@ -30,7 +30,7 @@
#ifndef QPROXYLAYOUTITEM_H
#define QPROXYLAYOUTITEM_H
#include <qml.h>
#include <qdeclarative.h>
#include <QGraphicsLayout>
QT_BEGIN_HEADER
......@@ -78,6 +78,9 @@ public:
void setItem(QGraphicsLayoutItem *);
void setEnabled(bool);
static void registerDeclarativeTypes();
protected:
virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
......
......@@ -28,7 +28,7 @@
**************************************************************************/
#include "qml.h"
#include "qdeclarative.h"
#include "resetwidget.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
......@@ -41,7 +41,6 @@
#include <QApplication>
QML_DECLARE_TYPE(QmlDesigner::ResetWidget);
QML_DEFINE_TYPE(Bauhaus, 1, 0, ResetWidget, QmlDesigner::ResetWidget);
namespace QmlDesigner {
......@@ -58,6 +57,11 @@ ResetWidget::ResetWidget(QWidget *parent) : QGroupBox(parent), m_backendObject(0
setLayout(m_vlayout);
}
void ResetWidget::registerDeclarativeType()
{
QML_REGISTER_TYPE(Bauhaus, 1, 0, ResetWidget, QmlDesigner::ResetWidget);
}
void ResetWidget::resetView()
{
m_tableWidget->clear();
......
......@@ -64,6 +64,8 @@ public:
setupView();
}
static void registerDeclarativeType();
public slots:
void buttonPressed(const QString &name);
......
<
......@@ -43,10 +43,10 @@
#include <QtGui/QPushButton>
#include <QtGui/QMessageBox>