Changeset View
Changeset View
Standalone View
Standalone View
src/ktoolbar.cpp
Show First 20 Lines • Show All 1321 Lines • ▼ Show 20 Line(s) | 1315 | if (QWidget *ww = qobject_cast<QWidget *>(watched)) { | |||
---|---|---|---|---|---|
1322 | } | 1322 | } | ||
1323 | } | 1323 | } | ||
1324 | } | 1324 | } | ||
1325 | 1325 | | |||
1326 | QToolButton *tb; | 1326 | QToolButton *tb; | ||
1327 | if ((tb = qobject_cast<QToolButton *>(watched))) { | 1327 | if ((tb = qobject_cast<QToolButton *>(watched))) { | ||
1328 | const QList<QAction *> tbActions = tb->actions(); | 1328 | const QList<QAction *> tbActions = tb->actions(); | ||
1329 | if (!tbActions.isEmpty()) { | 1329 | if (!tbActions.isEmpty()) { | ||
1330 | // Handle MMB on toolbar buttons | | |||
1331 | if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) { | | |||
1332 | QMouseEvent *me = static_cast<QMouseEvent *>(event); | | |||
1333 | if (me->button() == Qt::MidButton /*&& | | |||
1334 | act->receivers(SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)))*/) { | | |||
1335 | QAction *act = tbActions.first(); | | |||
1336 | if (me->type() == QEvent::MouseButtonPress) { | | |||
1337 | tb->setDown(act->isEnabled()); | | |||
1338 | } else { | | |||
1339 | tb->setDown(false); | | |||
1340 | if (act->isEnabled()) { | | |||
1341 | QMetaObject::invokeMethod(act, "triggered", Qt::DirectConnection, | | |||
1342 | Q_ARG(Qt::MouseButtons, me->button()), | | |||
1343 | Q_ARG(Qt::KeyboardModifiers, QApplication::keyboardModifiers())); | | |||
1344 | } | | |||
1345 | } | | |||
1346 | } | | |||
1347 | } | | |||
1348 | | ||||
1349 | // CJK languages use more verbose accelerator marker: they add a Latin | 1330 | // CJK languages use more verbose accelerator marker: they add a Latin | ||
1350 | // letter in parenthesis, and put accelerator on that. Hence, the default | 1331 | // letter in parenthesis, and put accelerator on that. Hence, the default | ||
1351 | // removal of ampersand only may not be enough there, instead the whole | 1332 | // removal of ampersand only may not be enough there, instead the whole | ||
1352 | // parenthesis construct should be removed. Use KLocalizedString's method to do this. | 1333 | // parenthesis construct should be removed. Use KLocalizedString's method to do this. | ||
1353 | if (event->type() == QEvent::Show || event->type() == QEvent::Paint || event->type() == QEvent::EnabledChange) { | 1334 | if (event->type() == QEvent::Show || event->type() == QEvent::Paint || event->type() == QEvent::EnabledChange) { | ||
1354 | QAction *act = tb->defaultAction(); | 1335 | QAction *act = tb->defaultAction(); | ||
1355 | if (act) { | 1336 | if (act) { | ||
1356 | const QString text = KLocalizedString::removeAcceleratorMarker(act->iconText().isEmpty() ? act->text() : act->iconText()); | 1337 | const QString text = KLocalizedString::removeAcceleratorMarker(act->iconText().isEmpty() ? act->text() : act->iconText()); | ||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |