Commit dbfe2e7f authored by Kai Koehne's avatar Kai Koehne
Browse files

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
......@@ -29,10 +29,10 @@
#include "basicwidgets.h"
#include <qlayoutobject.h>
#include <private/graphicswidgets_p.h>
#include <qmlcontext.h>
#include <qmlengine.h>
#include <qmlcomponent.h>
//#include <private/graphicswidgets_p.h>
#include <QDeclarativeContext>
#include <QDeclarativeEngine>
#include <QDeclarativeComponent>
#include <QtCore/QDebug>
#include <QFile>
#include <QPixmap>
......@@ -68,9 +68,9 @@ class QWidgetDeclarativeUI : public QObject
{
Q_OBJECT
Q_PROPERTY(QmlListProperty<QObject> children READ children)
Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children)
Q_PROPERTY(QLayoutObject *layout READ layout WRITE setLayout)
Q_PROPERTY(QmlListProperty<Action> actions READ actions)
Q_PROPERTY(QDeclarativeListProperty<Action> actions READ actions)
Q_PROPERTY(QFont font READ font CONSTANT)
Q_PROPERTY(QPoint pos READ pos)
......@@ -155,8 +155,8 @@ public:
emit mouseOverChanged();
}
QmlListProperty<QObject> children() {
return QmlListProperty<QObject>(this, 0, children_append, children_count, children_at, children_clear);
QDeclarativeListProperty<QObject> children() {
return QDeclarativeListProperty<QObject>(this, 0, children_append, children_count, children_at, children_clear);
}
QLayoutObject *layout() const { return _layout; }
......@@ -374,8 +374,8 @@ public:
}
QmlListProperty<Action> actions() {
return QmlListProperty<Action>(this, 0, actions_append, actions_count, actions_at, actions_clear);
QDeclarativeListProperty<Action> actions() {
return QDeclarativeListProperty<Action>(this, 0, actions_append, actions_count, actions_at, actions_clear);
}
private:
......@@ -386,7 +386,7 @@ private:
QGraphicsOpacityEffect *_graphicsOpacityEffect;
bool m_mouseOver;
static void children_append(QmlListProperty<QObject> *property, QObject *o) {
static void children_append(QDeclarativeListProperty<QObject> *property, QObject *o) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *q = p->q;
if (QWidget *w = qobject_cast<QWidget *>(o))
......@@ -395,19 +395,19 @@ private:
o->setParent(q);
}
static int children_count(QmlListProperty<QObject> *property) {
static int children_count(QDeclarativeListProperty<QObject> *property) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *q = p->q;
return q->children().count();
}
static QObject * children_at(QmlListProperty<QObject> *property, int index) {
static QObject * children_at(QDeclarativeListProperty<QObject> *property, int index) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *q = p->q;
return q->children().at(index);
}
static void children_clear(QmlListProperty<QObject> *property) {
static void children_clear(QDeclarativeListProperty<QObject> *property) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *q = p->q;
QObjectList c = q->children();
......@@ -416,25 +416,25 @@ private:
}
// ### Original had an insert, and removeAt
static void actions_append(QmlListProperty<Action> *property, Action *o) {
static void actions_append(QDeclarativeListProperty<Action> *property, Action *o) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *w = p->q;
o->setParent(w);
w->addAction(o);
}
static int actions_count(QmlListProperty<Action> *property) {
static int actions_count(QDeclarativeListProperty<Action> *property) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *w = p->q;
return w->actions().count();
}
static Action *actions_at(QmlListProperty<Action> *property, int index) {
static Action *actions_at(QDeclarativeListProperty<Action> *property, int index) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *w = p->q;
return qobject_cast<Action *>(w->actions().at(index));
}
static void actions_clear(QmlListProperty<Action> *property) {
static void actions_clear(QDeclarativeListProperty<Action> *property) {
QWidgetDeclarativeUI *p = static_cast<QWidgetDeclarativeUI *>(property->object);
QWidget *w = p->q;
......@@ -614,7 +614,7 @@ public:
}
private:
//if not for the at() function, we could use QmlList instead
//if not for the at() function, we could use QDeclarativeList instead
QMenu *menu;
......@@ -805,7 +805,7 @@ class WidgetLoader : public QWidget
Q_PROPERTY(QString sourceString READ sourceString WRITE setSourceString NOTIFY sourceChanged)
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(QWidget *widget READ widget NOTIFY widgetChanged)
Q_PROPERTY(QmlComponent *component READ component NOTIFY sourceChanged)
Q_PROPERTY(QDeclarativeComponent *component READ component NOTIFY sourceChanged)
public:
WidgetLoader(QWidget * parent = 0) : QWidget(parent), m_source(QUrl()), m_widget(0),
......@@ -824,7 +824,7 @@ public:
{ setSource(QUrl(url)); }
QWidget *widget() const;
QmlComponent *component() const
QDeclarativeComponent *component() const
{ return m_component; }
signals:
......@@ -834,7 +834,7 @@ signals:
private:
QUrl m_source;
QWidget *m_widget;
QmlComponent *m_component;
QDeclarativeComponent *m_component;
QVBoxLayout *m_layout;
QHash<QString, QWidget*> m_cachedWidgets;
};
......@@ -873,7 +873,7 @@ void WidgetLoader::setSource(const QUrl &source)
m_widget = m_cachedWidgets.value(source.toString());
m_widget->show();
} else {
m_component = new QmlComponent(qmlEngine(this), m_source, this);
m_component = new QDeclarativeComponent(qmlEngine(this), m_source, this);
if (m_component) {
emit sourceChanged();
......@@ -889,7 +889,7 @@ void WidgetLoader::setSource(const QUrl &source)
return;
}
QmlContext *ctxt = new QmlContext(qmlContext(this));
QDeclarativeContext *ctxt = new QDeclarativeContext(qmlContext(this));
ctxt->addDefaultObject(this);
QObject *obj = m_component->create(ctxt);
......@@ -1107,17 +1107,17 @@ class QTabWidgetDeclarativeUI : public QObject
{
Q_OBJECT
Q_PROPERTY(QmlListProperty<QTabObject> tabs READ tabs)
Q_PROPERTY(QDeclarativeListProperty<QTabObject> tabs READ tabs)
Q_CLASSINFO("DefaultProperty", "tabs")
public:
QTabWidgetDeclarativeUI(QObject *other) : QObject(other) {}
QmlListProperty<QTabObject> tabs() {
return QmlListProperty<QTabObject>(this, 0, tabs_append, 0, 0, tabs_clear);
QDeclarativeListProperty<QTabObject> tabs() {
return QDeclarativeListProperty<QTabObject>(this, 0, tabs_append, 0, 0, tabs_clear);
}
private:
static void tabs_append(QmlListProperty<QTabObject> *property, QTabObject *o) {
static void tabs_append(QDeclarativeListProperty<QTabObject> *property, QTabObject *o) {
QTabWidget *tw = static_cast<QTabWidget*>(property->object->parent());
if (!o->icon().isNull())
tw->addTab(o->content(), o->icon(), o->label());
......@@ -1125,7 +1125,7 @@ private:
tw->addTab(o->content(), o->label());
}
static void tabs_clear(QmlListProperty<QTabObject> *property) {
static void tabs_clear(QDeclarativeListProperty<QTabObject> *property) {
QTabWidget *tw = static_cast<QTabWidget*>(property->object->parent());
tw->clear();
}
......@@ -1140,66 +1140,71 @@ public:
{}
};
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QWidget,QWidget,QWidgetDeclarativeUI);
//display
QML_DEFINE_TYPE(Bauhaus,1,0,QProgressBar,QProgressBar)
QML_DEFINE_TYPE(Bauhaus,1,0,QLCDNumber,QLCDNumber)
//input
QML_DEFINE_TYPE(Bauhaus,1,0,QLineEdit,QLineEdit)
QML_DEFINE_TYPE(Bauhaus,1,0,QTextEdit,QTextEdit)
QML_DEFINE_TYPE(Bauhaus,1,0,QPlainTextEdit,QPlainTextEdit)
QML_DEFINE_TYPE(Bauhaus,1,0,QSpinBox,QSpinBox)
QML_DEFINE_TYPE(Bauhaus,1,0,QDoubleSpinBox,QDoubleSpinBox)
QML_DEFINE_TYPE(Bauhaus,1,0,QSlider,QSlider)
QML_DEFINE_TYPE(Bauhaus,1,0,QDateTimeEdit,QDateTimeEdit)
QML_DEFINE_TYPE(Bauhaus,1,0,QDateEdit,QDateEdit)
QML_DEFINE_TYPE(Bauhaus,1,0,QTimeEdit,QTimeEdit)
QML_DEFINE_TYPE(Bauhaus,1,0,QFontComboBox,QFontComboBox)
QML_DEFINE_TYPE(Bauhaus,1,0,QDial,QDial)
QML_DEFINE_TYPE(Bauhaus,1,0,QScrollBar,QScrollBar)
QML_DEFINE_TYPE(Bauhaus,1,0,QCalendarWidget, QCalendarWidget)
QML_DECLARE_TYPE(MyGroupBox)
QML_DECLARE_TYPE(WidgetLoader)
QML_DECLARE_TYPE(WidgetFrame)
//QML_DEFINE_TYPE(Bauhaus,1,0,QComboBox,QComboBox); //need a way to populate
//QML_DEFINE_EXTENDED_TYPE(QComboBox,QComboBox, QComboBox); //need a way to populate
//buttons
//QML_DEFINE_TYPE(Bauhaus,1,0,QPushButton,QPushButton);
QML_DEFINE_TYPE(Bauhaus,1,0,QCheckBox,QCheckBox)
QML_DEFINE_TYPE(Bauhaus,1,0,QGroupBox,QGroupBox)
QML_DEFINE_TYPE(Bauhaus,1,0,QAction,Action)
QML_DEFINE_TYPE(Bauhaus,1,0,QRadioButton,QRadioButton)
QML_DEFINE_TYPE(Bauhaus,1,0,FileWidget, FileWidget)
QML_DEFINE_TYPE(Bauhaus,1,0,LayoutWidget, LayoutWidget)
//containers
QML_DEFINE_TYPE(Bauhaus,1,0,QFrame,QFrame)
QML_DEFINE_TYPE(Bauhaus,1,0,WidgetFrame,WidgetFrame)
QML_DEFINE_TYPE(Bauhaus,1,0,WidgetLoader,WidgetLoader)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QExtGroupBox,MyGroupBox,QGroupBoxDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QTabWidget,QTabWidget,QTabWidgetDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QScrollArea,QScrollArea,QScrollAreaDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QPushButton,QPushButton,QPushButtonDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QLabel,QLabel,QLabelDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QToolButton,QToolButton, QToolButtonDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QComboBox,QComboBox, QComboBoxDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Bauhaus,1,0,QMenu,QMenu, QMenuDeclarativeUI)
//QML_DEFINE_TYPE(Bauhaus,1,0,BauhausoolBox,BauhausoolBox);
//QML_DEFINE_TYPE(Bauhaus,1,0,QScrollArea,QScrollArea);
//QML_DEFINE_EXTENDED_TYPE(BauhausColorButton,BauhausColorButton,BauhausColorButtonDeclarativeUI);
//itemviews
//QML_DEFINE_TYPE(Bauhaus,1,0,QListView,QListView);
//QML_DEFINE_TYPE(Bauhaus,1,0,BauhausreeView,BauhausreeView);
//QML_DEFINE_TYPE(Bauhaus,1,0,BauhausableView,BauhausableView);
QML_DECLARE_TYPE(QTabObject);
QML_DEFINE_TYPE(Qt,4,6,QTabObject,QTabObject); //### with namespacing, this should just be 'Tab'
QML_DECLARE_TYPE(MyGroupBox);
QML_DECLARE_TYPE(WidgetLoader);
QML_DECLARE_TYPE(WidgetFrame);
void BasicWidgets::registerDeclarativeTypes()
{
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QWidget,QWidget,QWidgetDeclarativeUI);
//display
QML_REGISTER_TYPE(Bauhaus,1,0,QProgressBar,QProgressBar);
QML_REGISTER_TYPE(Bauhaus,1,0,QLCDNumber,QLCDNumber);
//input
QML_REGISTER_TYPE(Bauhaus,1,0,QLineEdit,QLineEdit);
QML_REGISTER_TYPE(Bauhaus,1,0,QTextEdit,QTextEdit);
QML_REGISTER_TYPE(Bauhaus,1,0,QPlainTextEdit,QPlainTextEdit);
QML_REGISTER_TYPE(Bauhaus,1,0,QSpinBox,QSpinBox);
QML_REGISTER_TYPE(Bauhaus,1,0,QDoubleSpinBox,QDoubleSpinBox);
QML_REGISTER_TYPE(Bauhaus,1,0,QSlider,QSlider);
QML_REGISTER_TYPE(Bauhaus,1,0,QDateTimeEdit,QDateTimeEdit);
QML_REGISTER_TYPE(Bauhaus,1,0,QDateEdit,QDateEdit);
QML_REGISTER_TYPE(Bauhaus,1,0,QTimeEdit,QTimeEdit);
QML_REGISTER_TYPE(Bauhaus,1,0,QFontComboBox,QFontComboBox);
QML_REGISTER_TYPE(Bauhaus,1,0,QDial,QDial);
QML_REGISTER_TYPE(Bauhaus,1,0,QScrollBar,QScrollBar);
QML_REGISTER_TYPE(Bauhaus,1,0,QCalendarWidget, QCalendarWidget);
//QML_REGISTER_TYPE(Bauhaus,1,0,QComboBox,QComboBox); //need a way to populate
//QML_REGISTER_EXTENDED_TYPE(QComboBox,QComboBox, QComboBox); //need a way to populate
//buttons
//QML_REGISTER_TYPE(Bauhaus,1,0,QPushButton,QPushButton);
QML_REGISTER_TYPE(Bauhaus,1,0,QCheckBox,QCheckBox);
QML_REGISTER_TYPE(Bauhaus,1,0,QGroupBox,QGroupBox);
QML_REGISTER_TYPE(Bauhaus,1,0,QAction,Action);
QML_REGISTER_TYPE(Bauhaus,1,0,QRadioButton,QRadioButton);
QML_REGISTER_TYPE(Bauhaus,1,0,FileWidget, FileWidget);
QML_REGISTER_TYPE(Bauhaus,1,0,LayoutWidget, LayoutWidget);
//containers
QML_REGISTER_TYPE(Bauhaus,1,0,QFrame,QFrame);
QML_REGISTER_TYPE(Bauhaus,1,0,WidgetFrame,WidgetFrame);
QML_REGISTER_TYPE(Bauhaus,1,0,WidgetLoader,WidgetLoader);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QExtGroupBox,MyGroupBox,QGroupBoxDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QTabWidget,QTabWidget,QTabWidgetDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QScrollArea,QScrollArea,QScrollAreaDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QPushButton,QPushButton,QPushButtonDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QLabel,QLabel,QLabelDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QToolButton,QToolButton, QToolButtonDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QComboBox,QComboBox, QComboBoxDeclarativeUI);
QML_REGISTER_EXTENDED_TYPE(Bauhaus,1,0,QMenu,QMenu, QMenuDeclarativeUI);
//QML_REGISTER_TYPE(Bauhaus,1,0,BauhausoolBox,BauhausoolBox);
//QML_REGISTER_TYPE(Bauhaus,1,0,QScrollArea,QScrollArea);
//QML_REGISTER_EXTENDED_TYPE(BauhausColorButton,BauhausColorButton,BauhausColorButtonDeclarativeUI);
//itemviews
//QML_REGISTER_TYPE(Bauhaus,1,0,QListView,QListView);
//QML_REGISTER_TYPE(Bauhaus,1,0,BauhausreeView,BauhausreeView);
//QML_REGISTER_TYPE(Bauhaus,1,0,BauhausableView,BauhausableView);
QML_REGISTER_TYPE(Qt,4,6,QTabObject,QTabObject); //### with namespacing, this should just be 'Tab'
}
#include "basicwidgets.moc"
......@@ -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))
{
......