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
|
||||
QPushButton *pb = qobject_cast<QPushButton*>(object());
|
||||
if (pb && pb->isDefault())
|
||||
str = (QString)QKeySequence(Qt::Key_Enter);
|
||||
str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText);
|
||||
#endif
|
||||
if (str.isEmpty())
|
||||
str = qt_accHotKey(button()->text());
|
||||
|
@ -128,7 +128,7 @@ QString Q_WIDGETS_EXPORT qt_accHotKey(const QString &text)
|
||||
}
|
||||
if (ac.isNull())
|
||||
return QString();
|
||||
return (QString)QKeySequence(Qt::ALT) + ac.toUpper();
|
||||
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + ac.toUpper();
|
||||
#else
|
||||
Q_UNUSED(text);
|
||||
return QString();
|
||||
|
@ -1365,13 +1365,13 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
|
||||
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
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) {
|
||||
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();
|
||||
for (int i = 0; i < buttons.count(); ++i) {
|
||||
QAbstractButton *pb = buttons.at(i);
|
||||
int acc = pb->shortcut() & ~((int)Qt::MODIFIER_MASK|(int)Qt::UNICODE_ACCEL);
|
||||
if (acc == key) {
|
||||
QKeySequence shortcut = pb->shortcut();
|
||||
if (!shortcut.isEmpty() && key == (shortcut[0] & ~Qt::MODIFIER_MASK)) {
|
||||
pb->animateClick();
|
||||
return;
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ QAction::event(QEvent *e)
|
||||
"QAction::event",
|
||||
"Received shortcut event from incorrect shortcut");
|
||||
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
|
||||
activate(Trigger);
|
||||
return true;
|
||||
|
@ -75,7 +75,8 @@
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qshortcutmap_p.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
|
||||
#define ACCEL_KEY(k) QString()
|
||||
#endif
|
||||
|
@ -295,7 +295,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
|
||||
} else {
|
||||
QKeySequence seq = action->shortcut();
|
||||
if (!seq.isEmpty())
|
||||
tabWidth = qMax(int(tabWidth), qfm.width(seq));
|
||||
tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText)));
|
||||
#endif
|
||||
}
|
||||
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) {
|
||||
QKeySequence seq = action->shortcut();
|
||||
if (!seq.isEmpty())
|
||||
textAndAccel += QLatin1Char('\t') + QString(seq);
|
||||
textAndAccel += QLatin1Char('\t') + seq.toString(QKeySequence::NativeText);
|
||||
}
|
||||
#endif
|
||||
option->text = textAndAccel;
|
||||
|
@ -84,7 +84,9 @@
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qshortcutmap_p.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
|
||||
#define ACCEL_KEY(k) QString()
|
||||
#endif
|
||||
|
@ -1079,7 +1079,8 @@ QWorkspacePrivate::init()
|
||||
actions[QWorkspacePrivate::CloseAct] = new QAction(QIcon(q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, q)),
|
||||
QWorkspace::tr("&Close")
|
||||
#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
|
||||
,q);
|
||||
QObject::connect(actions[QWorkspacePrivate::CloseAct], SIGNAL(triggered()), q, SLOT(closeActiveWindow()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user