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

« back to all changes in this revision

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

  • Committer: CI Train Bot
  • Author(s): Christian Dywan, Zsombor Egri, Zoltán Balogh, Tim Peeters, Albert Astals Cid, Michael Sheldon, Benjamin Zeller
  • Date: 2015-12-17 17:13:49 UTC
  • mfrom: (1000.739.27 OTA9-landing-2015-12-16)
  • Revision ID: ci-train-bot@canonical.com-20151217171349-8xwclnhnx8v9oz4m
OTA9-landing-2015-12-16
Approved by: Zoltan Balogh

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
    IS_SIGNAL_CONNECTED(q, UCAbstractButton, pressAndHold, ());
82
82
}
83
83
 
 
84
void UCAbstractButtonPrivate::onClicked()
 
85
{
 
86
    Q_Q(UCAbstractButton);
 
87
    // call the overridden QML trigger function
 
88
    invokeTrigger<UCAbstractButton>(q, QVariant());
 
89
    // then emit the clicked signal
 
90
    Q_EMIT q->clicked();
 
91
}
 
92
 
84
93
void UCAbstractButton::classBegin()
85
94
{
86
95
    UCActionItem::classBegin();
137
146
    }
138
147
    // play haptics
139
148
    HapticsProxy::instance().play(QVariant());
140
 
    Q_EMIT q->clicked();
141
 
    // call the overridden QML trigger function
142
 
    invokeTrigger<UCAbstractButton>(q, QVariant());
 
149
    onClicked();
143
150
}
144
151
 
145
152
// handle pressAndHold
154
161
}
155
162
 
156
163
// emit clicked when Enter/Return is pressed
157
 
void UCAbstractButton::keyPressEvent(QKeyEvent *event)
 
164
void UCAbstractButton::keyReleaseEvent(QKeyEvent *event)
158
165
{
159
 
    UCActionItem::keyPressEvent(event);
 
166
    UCActionItem::keyReleaseEvent(event);
160
167
 
161
168
    switch (event->key()) {
162
169
        case Qt::Key_Enter:
163
170
        case Qt::Key_Return:
164
171
        case Qt::Key_Space:
165
 
        {
166
 
            // trigger clicked signal first
167
 
            Q_EMIT clicked();
168
 
            // then invoke the overloaded trigger
169
 
            invokeTrigger<UCAbstractButton>(this, QVariant());
170
 
            break;
171
 
        }
 
172
            d_func()->onClicked();
 
173
            break;
 
174
        default:
 
175
            break;
172
176
    }
173
177
}
174
178