Пример #1
0
void FaceGroup::itemHoverMoveEvent(QGraphicsSceneHoverEvent* e)
{
    if (d->showOnHover && !isVisible())
    {
        qreal distance;
        RegionFrameItem* const item = closestItem(e->scenePos(), &distance);

        // There's a possible nuisance when the direct mouse way from hovering pos to HUD widget
        // is not part of the condition. Maybe, we should add a exemption for this case.
        if (distance < 25)
        {
            setVisibleItem(item);
        }
        else
        {
            // get all items close to pos
            QList<QGraphicsItem*> hotItems = d->hotItems(e->scenePos());
            // this will be the one item shown by mouse over
            QList<QObject*> visible        = d->visibilityController->visibleItems(ItemVisibilityController::ExcludeFadingOut);

            foreach(QGraphicsItem* const item, hotItems)
            {
                foreach(QObject* const parent, visible)
                {
                    if (static_cast<QGraphicsObject*>(parent)->isAncestorOf(item))
                    {
                        return;
                    }
                }
            }

            setVisibleItem(0);
        }
Пример #2
0
ListView::ListView(QWidget *parent, const char *name,
                   int visibleItem)
    : KListView(parent, name)
{
    setVisibleItem(visibleItem);
}