Logo Search packages:      
Sourcecode: qt4-x11 version File versions

bool QGraphicsWidget::event ( QEvent event  )  [protected, virtual, inherited]

QGraphicsWidget handles the following events:

Event Usage Polish Delivered to the widget some time after it has been shown. GraphicsSceneMove Delivered to the widget after its local position has changed. GraphicsSceneResize Delivered to the widget after its size has changed. Show Delivered to the widget before it has been shown. Hide Delivered to the widget after it has been hidden. PaletteChange Delivered to the widget after its palette has changed. FontChange Delivered to the widget after its font has changed. EnabledChange Delivered to the widget after its enabled state has changed. StyleChange Delivered to the widget after its style has changed. LayoutDirectionChange Delivered to the widget after its layout direction has changed. ContentsRectChange Delivered to the widget after its contents margins/ contents rect has changed.

Reimplemented from QObject.

Reimplemented in QGraphicsProxyWidget.

Definition at line 1164 of file qgraphicswidget.cpp.

References QGraphicsItem::acceptsHoverEvents(), QGraphicsWidget::changeEvent(), QGraphicsItem::childItems(), QGraphicsWidget::closeEvent(), QObject::event(), QGraphicsWidget::grabKeyboardEvent(), QGraphicsWidget::grabMouseEvent(), QGraphicsWidget::hideEvent(), QGraphicsItem::isWidget(), QGraphicsWidget::moveEvent(), QGraphicsWidget::polishEvent(), QGraphicsWidget::resizeEvent(), QCoreApplication::sendEvent(), QGraphicsWidget::showEvent(), QEvent::type(), QGraphicsWidget::ungrabKeyboardEvent(), QGraphicsWidget::ungrabMouseEvent(), QGraphicsItem::update(), and QGraphicsWidget::windowFrameEvent().

Referenced by QGraphicsProxyWidget::event(), QGraphicsWidget::itemChange(), QGraphicsWidget::setGeometry(), and QGraphicsWidget::setStyle().

{
    Q_D(QGraphicsWidget);
    // Forward the event to the layout first.
    if (d->layout)
        d->layout->widgetEvent(event);

    // Handle the event itself.
    switch (event->type()) {
    case QEvent::GraphicsSceneMove:
        moveEvent(static_cast<QGraphicsSceneMoveEvent *>(event));
        break;
    case QEvent::GraphicsSceneResize:
        resizeEvent(static_cast<QGraphicsSceneResizeEvent *>(event));
        break;
    case QEvent::Show:
        showEvent(static_cast<QShowEvent *>(event));
        break;
    case QEvent::Hide:
        hideEvent(static_cast<QHideEvent *>(event));
        break;
    case QEvent::Polish:
        polishEvent();
        break;
    case QEvent::WindowActivate:
    case QEvent::WindowDeactivate:
        update();
        foreach (QGraphicsItem *child, childItems()) {
            if (child->isWidget())
                QApplication::sendEvent(static_cast<QGraphicsWidget *>(child), event);
        }
        break;
        // Taken from QWidget::event
    case QEvent::ActivationChange:
    case QEvent::EnabledChange:
    case QEvent::FontChange:
    case QEvent::StyleChange:
    case QEvent::PaletteChange:
    case QEvent::ParentChange:
    case QEvent::ContentsRectChange:
    case QEvent::LayoutDirectionChange:
        changeEvent(event);
        break;
    case QEvent::Close:
        closeEvent((QCloseEvent *)event);
        break;
    case QEvent::GrabMouse:
        grabMouseEvent(event);
        break;
    case QEvent::UngrabMouse:
        ungrabMouseEvent(event);
        break;
    case QEvent::GrabKeyboard:
        grabKeyboardEvent(event);
        break;
    case QEvent::UngrabKeyboard:
        ungrabKeyboardEvent(event);
        break;
    case QEvent::GraphicsSceneMousePress:
        if (d->hasDecoration() && windowFrameEvent(event))
            return true;
    case QEvent::GraphicsSceneMouseMove:
    case QEvent::GraphicsSceneMouseRelease:
    case QEvent::GraphicsSceneMouseDoubleClick:
        if (d->hasDecoration() && d->grabbedSection != Qt::NoSection)
            return windowFrameEvent(event);
        break;
    case QEvent::GraphicsSceneHoverEnter:
    case QEvent::GraphicsSceneHoverMove:
    case QEvent::GraphicsSceneHoverLeave:
        if (d->hasDecoration()) {
            windowFrameEvent(event);
            // Filter out hover events if they were sent to us only because of the
            // decoration (special case in QGraphicsScenePrivate::dispatchHoverEvent).
            if (!acceptsHoverEvents())
                return true;
        }
        break;
    default:
        break;
    }
    return QObject::event(event);
}


Generated by  Doxygen 1.6.0   Back to index