~ubuntu-sdk-team/ubuntu-ui-toolkit/clipScrollbar

« back to all changes in this revision

Viewing changes to src/Ubuntu/Components/plugin/uclistitem.cpp

  • Committer: Tarmac
  • Author(s): Christian Dywan
  • Date: 2016-06-02 13:12:15 UTC
  • mfrom: (1983.2.2 uut.acceptTheAbstract)
  • Revision ID: tarmac-20160602131215-3pg6cwwvcsc6me5a
UCListItem needs to handle click/trigger by keyboard. Fixes: https://bugs.launchpad.net/bugs/1581027.

Approved by ubuntu-sdk-build-bot, Zsombor Egri.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1484
1484
    update();
1485
1485
}
1486
1486
 
 
1487
// emit clicked when Enter/Return/Space is pressed
 
1488
void UCListItem::keyReleaseEvent(QKeyEvent *event)
 
1489
{
 
1490
    Q_D(UCListItem);
 
1491
 
 
1492
    UCStyledItemBase::keyReleaseEvent(event);
 
1493
 
 
1494
    switch (event->key()) {
 
1495
        case Qt::Key_Enter:
 
1496
        case Qt::Key_Return:
 
1497
        case Qt::Key_Space:
 
1498
            event->accept();
 
1499
            clicked();
 
1500
            if (d->mainAction) {
 
1501
                invokeTrigger<UCAction>(d->mainAction, d->index());
 
1502
            }
 
1503
            break;
 
1504
        default:
 
1505
            break;
 
1506
    }
 
1507
}
 
1508
 
 
1509
 
1487
1510
// handle horizontal keys to navigate between focusable slots
1488
1511
void UCListItem::keyPressEvent(QKeyEvent *event)
1489
1512
{