Ejemplo n.º 1
0
void medViewEventFilter::removeFromView(medAbstractView * view)
{
    if ( m_views.contains(view)) {
        QObject * filterObj = medViewEventFilter::objectToFilter(view);
        filterObj->removeEventFilter( this );
        m_views.remove(view);
        disconnect(view, SIGNAL(destroyed(QObject*)), this, SLOT(onViewDestroyed(QObject*)));
    }
Ejemplo n.º 2
0
void EventHub::removeEventHandler( const qt::Object& watched )
{
    QObject* obj = watched.get();
    if( isObjectFiltered( obj ) )
    {
        obj->removeEventFilter( this );
        _filteredObjects.erase( obj );
    }
}
Ejemplo n.º 3
0
void ItemBackground::setTargetItem(QGraphicsItem *target)
{
    if (d->target && d->target != target) {
        QObject *obj = 0;
        if (d->target->isWidget()) {
            obj = static_cast<QGraphicsWidget*>(d->target);
            obj->removeEventFilter(this);
        } else {
            d->target->removeSceneEventFilter(this);
            obj = dynamic_cast<QObject *>(d->target);
        }

        if (obj) {
            disconnect(obj, 0, this, 0);
        }
    }

    if (!target) {
        hide();
    }

    bool newTarget = (d->target != target);
    d->target = target;
    if (target) {
        setZValue(target->zValue() - 1);
        if (parentItem() != target->parentItem()) {
            QTransform t = transform();
            setTransform(QTransform());
            QRectF geom = mapToScene(geometry()).boundingRect();
            setGeometry(mapFromScene(geom).boundingRect());
            setTransform(t);
        }

        QRectF rect = target->boundingRect();
        rect.moveTopLeft(mapToParent(mapFromScene(target->mapToScene(QPointF(0, 0)))));

        setTarget(rect);


        if (newTarget) {
            QObject *obj = 0;
            if (target->isWidget()) {
                obj = static_cast<QGraphicsWidget*>(target);
                obj->installEventFilter(this);
            } else {
                d->target->installSceneEventFilter(this);
                obj = dynamic_cast<QObject *>(target);
            }

            if (obj) {
                connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(targetDestroyed(QObject*)));
            }
        }
    }
}
Ejemplo n.º 4
0
void KisInputManager::Private::CanvasSwitcher::removeCanvas(KisCanvas2 *canvas)
{
    QObject *widget = canvas->canvasWidget();

    canvasResolver.remove(widget);

    if (d->eventsReceiver == widget) {
        d->q->setupAsEventFilter(0);
    }

    widget->removeEventFilter(this);
}
/*!
  \brief En/disable the magnifier

  When enabled is true an event filter is installed for
  the observed widget, otherwise the event filter is removed.

  \param on true or false
  \sa isEnabled(), eventFilter()
*/
void QwtMagnifier::setEnabled( bool on )
{
    if ( d_data->isEnabled != on )
    {
        d_data->isEnabled = on;

        QObject *o = parent();
        if ( o )
        {
            if ( d_data->isEnabled )
                o->installEventFilter( this );
            else
                o->removeEventFilter( this );
        }
    }
}