diff options
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 20 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 14 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget_p.cpp | 9 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 7fcf4d2..7f43b96 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1090,6 +1090,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (newParent == parent) return; + if (isWidget) + static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent && + newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0, + scene); if (scene) { // Deliver the change to the index if (scene->d_func()->indexMethod != QGraphicsScene::NoIndex) @@ -1803,9 +1807,6 @@ static void _q_qgraphicsItemSetFlag(QGraphicsItem *item, QGraphicsItem::Graphics */ void QGraphicsItem::setFlags(GraphicsItemFlags flags) { - if (isWindow()) - flags |= ItemIsPanel; - // Notify change and check for adjustment. if (quint32(d_ptr->flags) == quint32(flags)) return; @@ -7644,7 +7645,13 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) manager->cleanupCachedGestures(this, gesture); } } +/*! + Updates the item's micro focus. This is slot for convenience. + \since 4.7 + + \sa QInputContext +*/ void QGraphicsObject::updateMicroFocus() { QGraphicsItem::updateMicroFocus(); @@ -7953,6 +7960,13 @@ void QGraphicsItemPrivate::resetHeight() */ /*! + \property QGraphicsObject::effect + \brief the effect attached to this item + + \sa QGraphicsItem::setGraphicsEffect(), QGraphicsItem::graphicsEffect() +*/ + +/*! \class QAbstractGraphicsShapeItem \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 06a44b7..478c0c3 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -747,6 +747,17 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c } /*! + \property QGraphicsWidget::layout + \brief The layout of the widget +*/ + +/*! + \fn void QGraphicsWidget::layoutChanged() + This signal gets emitted whenever the layout of the item changes + \internal +*/ + +/*! Returns this widget's layout, or 0 if no layout is currently managing this widget. @@ -1094,9 +1105,6 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & } break; case ItemParentChange: { - QGraphicsItem *parent = qVariantValue<QGraphicsItem *>(value); - d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0, scene()); - // Deliver ParentAboutToChange. QEvent event(QEvent::ParentAboutToChange); QApplication::sendEvent(this, &event); diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 6e397b6..50b315a 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -71,14 +71,17 @@ void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFl adjustWindowFlags(&wFlags); windowFlags = wFlags; - q->setParentItem(parentItem); + if (parentItem) + setParentItemHelper(parentItem, 0, 0); + q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType)); q->setGraphicsItem(q); resolveLayoutDirection(); q->unsetWindowFrameMargins(); - q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption); - q->setFlag(QGraphicsItem::ItemSendsGeometryChanges); + flags |= QGraphicsItem::ItemUsesExtendedStyleOption | QGraphicsItem::ItemSendsGeometryChanges; + if (windowFlags & Qt::Window) + flags |= QGraphicsItem::ItemIsPanel; } qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const |