Remove use of deprecated conversion from QKeySequence
Note: UNICODE_ACCEL is Qt3 compatibility and is equal to 0 Change-Id: I808a66772abceb3822d515d69386728264eb1b40 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
05e24901a1
commit
bc6ad75d18
@ -115,7 +115,7 @@ QString QAccessibleButton::text(QAccessible::Text t) const
|
|||||||
#ifndef QT_NO_SHORTCUT
|
#ifndef QT_NO_SHORTCUT
|
||||||
QPushButton *pb = qobject_cast<QPushButton*>(object());
|
QPushButton *pb = qobject_cast<QPushButton*>(object());
|
||||||
if (pb && pb->isDefault())
|
if (pb && pb->isDefault())
|
||||||
str = (QString)QKeySequence(Qt::Key_Enter);
|
str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText);
|
||||||
#endif
|
#endif
|
||||||
if (str.isEmpty())
|
if (str.isEmpty())
|
||||||
str = qt_accHotKey(button()->text());
|
str = qt_accHotKey(button()->text());
|
||||||
|
@ -128,7 +128,7 @@ QString Q_WIDGETS_EXPORT qt_accHotKey(const QString &text)
|
|||||||
}
|
}
|
||||||
if (ac.isNull())
|
if (ac.isNull())
|
||||||
return QString();
|
return QString();
|
||||||
return (QString)QKeySequence(Qt::ALT) + ac.toUpper();
|
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + ac.toUpper();
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(text);
|
Q_UNUSED(text);
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -1365,13 +1365,13 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
|
|||||||
|
|
||||||
#ifndef QT_NO_SHORTCUT
|
#ifndef QT_NO_SHORTCUT
|
||||||
if (!(e->modifiers() & Qt::AltModifier)) {
|
if (!(e->modifiers() & Qt::AltModifier)) {
|
||||||
int key = e->key() & ~((int)Qt::MODIFIER_MASK|(int)Qt::UNICODE_ACCEL);
|
int key = e->key() & ~Qt::MODIFIER_MASK;
|
||||||
if (key) {
|
if (key) {
|
||||||
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();
|
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();
|
||||||
for (int i = 0; i < buttons.count(); ++i) {
|
for (int i = 0; i < buttons.count(); ++i) {
|
||||||
QAbstractButton *pb = buttons.at(i);
|
QAbstractButton *pb = buttons.at(i);
|
||||||
int acc = pb->shortcut() & ~((int)Qt::MODIFIER_MASK|(int)Qt::UNICODE_ACCEL);
|
QKeySequence shortcut = pb->shortcut();
|
||||||
if (acc == key) {
|
if (!shortcut.isEmpty() && key == (shortcut[0] & ~Qt::MODIFIER_MASK)) {
|
||||||
pb->animateClick();
|
pb->animateClick();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1119,7 +1119,7 @@ QAction::event(QEvent *e)
|
|||||||
"QAction::event",
|
"QAction::event",
|
||||||
"Received shortcut event from incorrect shortcut");
|
"Received shortcut event from incorrect shortcut");
|
||||||
if (se->isAmbiguous())
|
if (se->isAmbiguous())
|
||||||
qWarning("QAction::eventFilter: Ambiguous shortcut overload: %s", QString(se->key()).toLatin1().constData());
|
qWarning("QAction::eventFilter: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
|
||||||
else
|
else
|
||||||
activate(Trigger);
|
activate(Trigger);
|
||||||
return true;
|
return true;
|
||||||
|
@ -75,7 +75,8 @@
|
|||||||
#include "private/qapplication_p.h"
|
#include "private/qapplication_p.h"
|
||||||
#include "private/qshortcutmap_p.h"
|
#include "private/qshortcutmap_p.h"
|
||||||
#include "qkeysequence.h"
|
#include "qkeysequence.h"
|
||||||
#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString())
|
#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
|
||||||
|
QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
|
||||||
#else
|
#else
|
||||||
#define ACCEL_KEY(k) QString()
|
#define ACCEL_KEY(k) QString()
|
||||||
#endif
|
#endif
|
||||||
|
@ -295,7 +295,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
|
|||||||
} else {
|
} else {
|
||||||
QKeySequence seq = action->shortcut();
|
QKeySequence seq = action->shortcut();
|
||||||
if (!seq.isEmpty())
|
if (!seq.isEmpty())
|
||||||
tabWidth = qMax(int(tabWidth), qfm.width(seq));
|
tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
|
sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
|
||||||
@ -1187,7 +1187,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
|
|||||||
if (textAndAccel.indexOf(QLatin1Char('\t')) == -1) {
|
if (textAndAccel.indexOf(QLatin1Char('\t')) == -1) {
|
||||||
QKeySequence seq = action->shortcut();
|
QKeySequence seq = action->shortcut();
|
||||||
if (!seq.isEmpty())
|
if (!seq.isEmpty())
|
||||||
textAndAccel += QLatin1Char('\t') + QString(seq);
|
textAndAccel += QLatin1Char('\t') + seq.toString(QKeySequence::NativeText);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
option->text = textAndAccel;
|
option->text = textAndAccel;
|
||||||
|
@ -84,7 +84,9 @@
|
|||||||
#include "private/qapplication_p.h"
|
#include "private/qapplication_p.h"
|
||||||
#include "private/qshortcutmap_p.h"
|
#include "private/qshortcutmap_p.h"
|
||||||
#include <qkeysequence.h>
|
#include <qkeysequence.h>
|
||||||
#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString())
|
#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
|
||||||
|
QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define ACCEL_KEY(k) QString()
|
#define ACCEL_KEY(k) QString()
|
||||||
#endif
|
#endif
|
||||||
|
@ -1079,7 +1079,8 @@ QWorkspacePrivate::init()
|
|||||||
actions[QWorkspacePrivate::CloseAct] = new QAction(QIcon(q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, q)),
|
actions[QWorkspacePrivate::CloseAct] = new QAction(QIcon(q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, q)),
|
||||||
QWorkspace::tr("&Close")
|
QWorkspace::tr("&Close")
|
||||||
#ifndef QT_NO_SHORTCUT
|
#ifndef QT_NO_SHORTCUT
|
||||||
+QLatin1Char('\t')+(QString)QKeySequence(Qt::CTRL+Qt::Key_F4)
|
+ QLatin1Char('\t')
|
||||||
|
+ QKeySequence(Qt::CTRL+Qt::Key_F4).toString(QKeySequence::NativeText)
|
||||||
#endif
|
#endif
|
||||||
,q);
|
,q);
|
||||||
QObject::connect(actions[QWorkspacePrivate::CloseAct], SIGNAL(triggered()), q, SLOT(closeActiveWindow()));
|
QObject::connect(actions[QWorkspacePrivate::CloseAct], SIGNAL(triggered()), q, SLOT(closeActiveWindow()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user