Пример #1
0
void VideoWidget::mouseMoveEvent( QMouseEvent * event )
{
	int target = 0;
	if ( !playing && lastFrame && lastFrame->sample ) {
		for ( int i = 0; i < lastFrame->sample->frames.count(); ++i ) {
			Frame *f = lastFrame->sample->frames[i]->frame ;
			if ( f && f->glOVD ) {
				if ( leftButtonPressed ) {
					if ( ovdTarget > 0 )
						ovdUpdate( lastFrame->sample->frames[i], QPointF( event->pos() ) );
					return;
				}
				if ( event->modifiers() & Qt::ControlModifier ) {
					bool inside = cursorInside( event->pos() );
					if ( inside ) {
						if ( f->glOVD & FilterTransform::SCALE ) {
							setCursor( QCursor(Qt::SizeAllCursor) );
							target = OVDZOOMCENTER;
						}
					}
					else {
						setCursor( QCursor(Qt::PointingHandCursor) );
						target = OVDOUTSIDE;
					}					
				}
				else {
					if ( f->glOVD & FilterTransform::SCALE ) {
						if ( qAbs((ovdPoints[0] - event->pos()).manhattanLength()) < CURSORDISTANCE ) {
							setCursor( QCursor(Qt::SizeAllCursor) );
							target = OVDTOPLEFT;
						}
						else if ( qAbs((ovdPoints[2] - event->pos()).manhattanLength()) < CURSORDISTANCE ) {
							setCursor( QCursor(Qt::SizeAllCursor) );
							target = OVDBOTTOMRIGHT;
						}
						else if ( qAbs((ovdPoints[1] - event->pos()).manhattanLength()) < CURSORDISTANCE ) {
							setCursor( QCursor(Qt::SizeAllCursor) );
							target = OVDTOPRIGHT;
						}
						else if ( qAbs((ovdPoints[3] - event->pos()).manhattanLength()) < CURSORDISTANCE ) {
							setCursor( QCursor(Qt::SizeAllCursor) );
							target = OVDBOTTOMLEFT;
						}
					}
					if ( !target && cursorInside( event->pos() ) ) {
						setCursor( QCursor(Qt::PointingHandCursor) );
						target = OVDINSIDE;
					}
				}
				
				break;
			}
		}
	}
	
	ovdTarget = target;
	if ( ovdTarget == 0 && cursor().shape() != Qt::ArrowCursor )
		setCursor( QCursor(Qt::ArrowCursor) );
}
Пример #2
0
void Popup::mouseClick(int x, int y) {
    if (cursorInside(x,y)) {
        y -= int(m_pnl.GetY() + m_list.GetY());
        y /= 14;
        if (y < int(items.size()))
            if (items[y]->cb)
                items[y]->cb(items[y]);
    }
    prepareToDie();
}
Пример #3
0
void Popup::mouseOver(int x, int y) {
    for (std::vector<Popup::Item*>::iterator it = items.begin(); it != items.end(); it++) {
        Popup::Item* pi = *it;

        pi->pnl.SetBGActiveness(false);
    }
    if (cursorInside(x,y)) {
        y -= int(m_pnl.GetY() + m_list.GetY());
        y /= 14;
        if (y < int(items.size()) && items[y]->txt != "-")
            items[y]->pnl.SetBGActiveness(true);
        else if (items[y]->txt != "-") // separator
            printf("Warning: popup tried to highligh nonexisting listitem\n");
    }
}