diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-01 08:06:38 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-01 10:10:13 (GMT) |
commit | c15e07884a29be26f1110e4d54a56da0001e3c53 (patch) | |
tree | b81650fe5652e3fdd4592da73c3a6f3902bed3e1 /demos/boxes/qtbox.cpp | |
parent | c78d75db9467af9f5638073f74bed437c24c3584 (diff) | |
download | Qt-c15e07884a29be26f1110e4d54a56da0001e3c53.zip Qt-c15e07884a29be26f1110e4d54a56da0001e3c53.tar.gz Qt-c15e07884a29be26f1110e4d54a56da0001e3c53.tar.bz2 |
dynamic_cast in the demo was failing to build without rtti
Reviewed-by: Kim Motoyoshi Kalland
Diffstat (limited to 'demos/boxes/qtbox.cpp')
-rw-r--r-- | demos/boxes/qtbox.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp index 015bc95..54882fb 100644 --- a/demos/boxes/qtbox.cpp +++ b/demos/boxes/qtbox.cpp @@ -122,7 +122,7 @@ void ItemBase::duplicateSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) scene->addItem(itemBase->createNew(itemBase->m_size, itemBase->pos().x() + itemBase->m_size, itemBase->pos().y())); } @@ -137,7 +137,7 @@ void ItemBase::deleteSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) delete itemBase; } @@ -152,7 +152,7 @@ void ItemBase::growSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) { itemBase->prepareGeometryChange(); itemBase->m_size *= 2; @@ -171,7 +171,7 @@ void ItemBase::shrinkSelectedItems(QGraphicsScene *scene) selected = scene->selectedItems(); foreach (QGraphicsItem *item, selected) { - ItemBase *itemBase = dynamic_cast<ItemBase *>(item); + ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item); if (itemBase) { itemBase->prepareGeometryChange(); itemBase->m_size /= 2; @@ -257,6 +257,12 @@ void ItemBase::wheelEvent(QGraphicsSceneWheelEvent *event) m_size = MIN_ITEM_SIZE; } +int ItemBase::type() const +{ + return Type; +} + + bool ItemBase::isInResizeArea(const QPointF &pos) { return (-pos.y() < pos.x() - m_size + 9); |