summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxlayoutitem.cpp2
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp30
-rw-r--r--src/declarative/widgets/graphicslayouts.h4
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp4
4 files changed, 20 insertions, 20 deletions
diff --git a/src/declarative/fx/qfxlayoutitem.cpp b/src/declarative/fx/qfxlayoutitem.cpp
index 1f814e8..61998e7 100644
--- a/src/declarative/fx/qfxlayoutitem.cpp
+++ b/src/declarative/fx/qfxlayoutitem.cpp
@@ -78,7 +78,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,LayoutItem,QFxLayoutItem)
*/
QFxLayoutItem::QFxLayoutItem(QFxItem* parent)
- : QFxItem(parent), m_maximumSize(INT_MAX,INT_MAX), m_minimumSize(0,0), m_preferredSize(100,100)
+ : QFxItem(parent), m_maximumSize(INT_MAX,INT_MAX), m_minimumSize(0,0), m_preferredSize(0,0)
{
setGraphicsItem(this);
}
diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
index 34d18e4..8707b94 100644
--- a/src/declarative/widgets/graphicslayouts.cpp
+++ b/src/declarative/widgets/graphicslayouts.cpp
@@ -48,6 +48,10 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_INTERFACE(QGraphicsLayoutItem)
QML_DEFINE_INTERFACE(QGraphicsLayout)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsLinearLayoutStretchItem,QGraphicsLinearLayoutStretchItemObject)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsLinearLayout,QGraphicsLinearLayoutObject)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsGridLayout,QGraphicsGridLayoutObject)
+
class LinearLayoutAttached : public QObject
{
Q_OBJECT
@@ -89,7 +93,6 @@ private:
Qt::Alignment _alignment;
};
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsLinearLayoutStretchItem,QGraphicsLinearLayoutStretchItemObject)
QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent)
: QObject(parent)
@@ -103,7 +106,6 @@ QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, cons
return QSizeF();
}
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsLinearLayout,QGraphicsLinearLayoutObject)
QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
: QObject(parent), _children(this)
@@ -119,9 +121,9 @@ void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutIte
insertItem(index, item);
//connect attached properties
- if (QObject *obj = attachedProperties.value(item)) {
- setStretchFactor(item, static_cast<LinearLayoutAttached *>(obj)->stretchFactor());
- setAlignment(item, static_cast<LinearLayoutAttached *>(obj)->alignment());
+ if (LinearLayoutAttached *obj = attachedProperties.value(item)) {
+ setStretchFactor(item, obj->stretchFactor());
+ setAlignment(item, obj->alignment());
QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
@@ -147,7 +149,7 @@ void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt:
QGraphicsLinearLayout::setAlignment(item, alignment);
}
-QHash<QGraphicsLayoutItem*, QObject*> QGraphicsLinearLayoutObject::attachedProperties;
+QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> QGraphicsLinearLayoutObject::attachedProperties;
LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj)
{
// ### This is not allowed - you must attach to any object
@@ -246,8 +248,6 @@ private:
Qt::Alignment _alignment;
};
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsGridLayout,QGraphicsGridLayoutObject)
-
QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
: QObject(parent), _children(this)
@@ -277,12 +277,12 @@ void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
{
//use attached properties
- if (QObject *obj = attachedProperties.value(item)) {
- int row = static_cast<GridLayoutAttached *>(obj)->row();
- int column = static_cast<GridLayoutAttached *>(obj)->column();
- int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
- int columnSpan = static_cast<GridLayoutAttached *>(obj)->columnSpan();
- Qt::Alignment alignment = static_cast<GridLayoutAttached *>(obj)->alignment();
+ if (GridLayoutAttached *obj = attachedProperties.value(item)) {
+ int row = obj->row();
+ int column = obj->column();
+ int rowSpan = obj->rowSpan();
+ int columnSpan = obj->columnSpan();
+ Qt::Alignment alignment = obj->alignment();
if (row == -1 || column == -1) {
qWarning() << "Must set row and column for an item in a grid layout";
return;
@@ -307,7 +307,7 @@ qreal QGraphicsGridLayoutObject::spacing() const
return -1; //XXX
}
-QHash<QGraphicsLayoutItem*, QObject*> QGraphicsGridLayoutObject::attachedProperties;
+QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj)
{
// ### This is not allowed - you must attach to any object
diff --git a/src/declarative/widgets/graphicslayouts.h b/src/declarative/widgets/graphicslayouts.h
index 13811eb..863f846 100644
--- a/src/declarative/widgets/graphicslayouts.h
+++ b/src/declarative/widgets/graphicslayouts.h
@@ -92,7 +92,7 @@ private:
friend class LinearLayoutAttached;
void clearChildren();
void insertLayoutItem(int, QGraphicsLayoutItem *);
- static QHash<QGraphicsLayoutItem*, QObject*> attachedProperties;
+ static QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> attachedProperties;
class ChildList : public QmlList<QGraphicsLayoutItem *>
{
@@ -150,7 +150,7 @@ private:
void addWidget(QGraphicsWidget *);
void clearChildren();
void addLayoutItem(QGraphicsLayoutItem *);
- static QHash<QGraphicsLayoutItem*, QObject*> attachedProperties;
+ static QHash<QGraphicsLayoutItem*, GridLayoutAttached*> attachedProperties;
class ChildList : public QmlList<QGraphicsLayoutItem *>
{
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp
index 4c6dcf9..cfcc87b 100644
--- a/src/declarative/widgets/graphicswidgets.cpp
+++ b/src/declarative/widgets/graphicswidgets.cpp
@@ -59,7 +59,6 @@ public:
static_cast<QGraphicsView *>(parent())->setScene(scene);
}
};
-QML_DEFINE_EXTENDED_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsView,QGraphicsView,QGraphicsViewDeclarativeUI)
class QGraphicsSceneDeclarativeUI : public QObject
{
@@ -111,7 +110,6 @@ private:
};
Children _children;
};
-QML_DEFINE_EXTENDED_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsScene,QGraphicsScene,QGraphicsSceneDeclarativeUI)
class QGraphicsWidgetDeclarativeUI : public QObject
{
@@ -164,6 +162,8 @@ private:
QmlConcreteList<QObject *> _data;
};
+QML_DEFINE_EXTENDED_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsView,QGraphicsView,QGraphicsViewDeclarativeUI)
+QML_DEFINE_EXTENDED_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsScene,QGraphicsScene,QGraphicsSceneDeclarativeUI)
QML_DEFINE_EXTENDED_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QGraphicsWidget,QGraphicsWidget,QGraphicsWidgetDeclarativeUI)
QML_DEFINE_INTERFACE(QGraphicsItem)