void FingerList::mousePressEvent(QMouseEvent *e)
{
    int col = e->x() / ICONCHORD;
#if QT_VERSION < 300
    int row = (e->y() + yOffset()) / ICONCHORD;
#else
    int row = (e->y() + contentsY ()) / ICONCHORD;
#endif

    int n = row * perRow + col;

    if ((n >= 0) && (n < num)) {
		curSel = row * perRow + col;
#if QT_VERSION < 300
		repaint(oldCol * ICONCHORD, oldRow * ICONCHORD - yOffset(),
				ICONCHORD, ICONCHORD);
		repaint(col * ICONCHORD, row * ICONCHORD - yOffset(),
				ICONCHORD, ICONCHORD);
#else
		repaintCell(oldRow, oldCol);
		repaintCell(row, col);
#endif
		oldCol = col;
		oldRow = row;
		emit chordSelected(appl[curSel].f);
    }
}
Example #2
0
//==================================================================
void KCharSelectTable::mouseMoveEvent( QMouseEvent *e )
{
    const int row = rowAt( e->y() );
    const int col = columnAt( e->x() );
    if ( row >= 0 && row < numRows() && col >= 0 && col < numCols() ) {
	const QPoint oldPos = vPos;

	vPos.setX( col );
	vPos.setY( row );

	vChr = QChar( vTableNum * 256 + numCols() * vPos.y() + vPos.x() );

	const QPoint oldFocus = focusPos;

	focusPos = vPos;
	focusItem = vChr;

	repaintCell( oldFocus.y(), oldFocus.x(), true );
	repaintCell( oldPos.y(), oldPos.x(), true );
	repaintCell( vPos.y(), vPos.x(), true );

	emit highlighted( vChr );
	emit highlighted();

	emit focusItemChanged( focusItem );
	emit focusItemChanged();
    }
}
Example #3
0
//==================================================================
void KCharSelectTable::gotoDown()
{
    if ( focusPos.y() < numRows()-1 ) {
	const QPoint oldPos = focusPos;

	focusPos.setY( focusPos.y() + 1 );

	focusItem = QChar( vTableNum * 256 + numCols() * focusPos.y() + focusPos.x() );

	repaintCell( oldPos.y(), oldPos.x(), true );
	repaintCell( focusPos.y(), focusPos.x(), true );

	emit focusItemChanged( vChr );
	emit focusItemChanged();
    }
}
Example #4
0
void FingerList::mousePressEvent(QMouseEvent *e)
{
	int col = columnAt(e->x());
	int row = rowAt(e->y() + contentsY());

	int n = row * perRow + col;

	if ((n >= 0) && (n < num)) {
		curSel = row * perRow + col;
		repaintCell(oldRow, oldCol);
		repaintCell(row, col);
		oldCol = col;
		oldRow = row;
		emit chordSelected(appl[curSel].f);
	}
}
Example #5
0
//==================================================================
void KCharSelectTable::keyPressEvent( QKeyEvent *e )
{
    switch ( e->key() ) {
    case Key_Left:
	gotoLeft();
	break;
    case Key_Right:
	gotoRight();
	break;
    case Key_Up:
	gotoUp();
	break;
    case Key_Down:
	gotoDown();
	break;
    case Key_Next:
	emit tableDown();
	break;
    case Key_Prior:
	emit tableUp();
	break;
    case Key_Space:
	emit activated( ' ' );
	emit activated();
	emit highlighted( ' ' );
	emit highlighted();
        break;
    case Key_Enter: case Key_Return: {
	const QPoint oldPos = vPos;

	vPos = focusPos;
	vChr = focusItem;

	repaintCell( oldPos.y(), oldPos.x(), true );
	repaintCell( vPos.y(), vPos.x(), true );

	emit activated( vChr );
	emit activated();
	emit highlighted( vChr );
	emit highlighted();
    } break;
    }
}
void FingerList::setFirstChord() {
	if (!num) return;
	oldCol = 0;
	oldRow = 0;
	curSel = 0;
#if QT_VERSION < 300
	repaint(0, 0 - yOffset(), ICONCHORD, ICONCHORD);
#else
	repaintCell(0, 0);
#endif
	chordSelected(appl[0].f);
}