summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/freetype/LICENSE.txt2
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java58
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h1
-rw-r--r--src/corelib/serialization/qjson.cpp8
-rw-r--r--src/corelib/serialization/qjson_p.h2
-rw-r--r--src/corelib/serialization/qjsondocument.cpp3
-rw-r--r--src/corelib/tools/qsimd_p.h5
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp4
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm11
-rw-r--r--src/plugins/platforms/qnx/qqnxkeytranslator.h245
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp75
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp2
12 files changed, 183 insertions, 233 deletions
diff --git a/src/3rdparty/freetype/LICENSE.txt b/src/3rdparty/freetype/LICENSE.txt
index 382225f105..1119880c09 100644
--- a/src/3rdparty/freetype/LICENSE.txt
+++ b/src/3rdparty/freetype/LICENSE.txt
@@ -85,7 +85,7 @@ Introduction
encourage you to use the following text:
"""
- Portions of this software are copyright © <year> The FreeType
+ Portions of this software are copyright © <year> The FreeType
Project (www.freetype.org). All rights reserved.
"""
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
index 424bf45c53..531802959c 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
@@ -355,12 +355,21 @@ public abstract class QtLoader {
destinationFile.createNewFile();
AssetManager assetsManager = m_context.getAssets();
- InputStream inputStream = assetsManager.open(source);
- OutputStream outputStream = new FileOutputStream(destinationFile);
- copyFile(inputStream, outputStream);
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ inputStream = assetsManager.open(source);
+ outputStream = new FileOutputStream(destinationFile);
+ copyFile(inputStream, outputStream);
+ catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null)
+ inputStream.close();
- inputStream.close();
- outputStream.close();
+ if (outputStream != null)
+ outputStream.close();
+ }
}
private static void createBundledBinary(String source, String destination)
@@ -377,12 +386,21 @@ public abstract class QtLoader {
destinationFile.createNewFile();
- InputStream inputStream = new FileInputStream(source);
- OutputStream outputStream = new FileOutputStream(destinationFile);
- copyFile(inputStream, outputStream);
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ inputStream = new FileInputStream(source);
+ outputStream = new FileOutputStream(destinationFile);
+ copyFile(inputStream, outputStream);
+ catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null)
+ inputStream.close();
- inputStream.close();
- outputStream.close();
+ if (outputStream != null)
+ outputStream.close();
+ }
}
private boolean cleanCacheIfNecessary(String pluginsPrefix, long packageVersion)
@@ -391,12 +409,15 @@ public abstract class QtLoader {
long cacheVersion = 0;
if (versionFile.exists() && versionFile.canRead()) {
+ DataInputStream inputStream = null;
try {
- DataInputStream inputStream = new DataInputStream(new FileInputStream(versionFile));
+ inputStream = new DataInputStream(new FileInputStream(versionFile));
cacheVersion = inputStream.readLong();
- inputStream.close();
} catch (Exception e) {
e.printStackTrace();
+ } finally {
+ if (inputStream != null)
+ inputStream.close();
}
}
@@ -431,9 +452,16 @@ public abstract class QtLoader {
versionFile.createNewFile();
- DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(versionFile));
- outputStream.writeLong(packageVersion);
- outputStream.close();
+ DataOutputStream outputStream = null;
+ try {
+ outputStream = new DataOutputStream(new FileOutputStream(versionFile));
+ outputStream.writeLong(packageVersion);
+ catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (outputStream != null)
+ outputStream.close();
+ }
}
{
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 4775d3d47a..bd8da5c35d 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -87,6 +87,7 @@ public:
QT_DEPRECATED inline void registerTimer(int timerId, int interval, QObject *object)
{ registerTimer(timerId, interval, Qt::CoarseTimer, object); }
#endif
+ // ### Qt6: change interval range to qint64 (or use QDeadlineTimer)
int registerTimer(int interval, Qt::TimerType timerType, QObject *object);
virtual void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) = 0;
virtual bool unregisterTimer(int timerId) = 0;
diff --git a/src/corelib/serialization/qjson.cpp b/src/corelib/serialization/qjson.cpp
index e4bca3bcd0..592f6168dc 100644
--- a/src/corelib/serialization/qjson.cpp
+++ b/src/corelib/serialization/qjson.cpp
@@ -328,7 +328,7 @@ int Value::usedStorage(const Base *b) const
bool Value::isValid(const Base *b) const
{
- int offset = 0;
+ int offset = -1;
switch (type) {
case QJsonValue::Double:
if (latinOrIntValue)
@@ -345,14 +345,12 @@ bool Value::isValid(const Base *b) const
break;
}
- if (!offset)
+ if (offset == -1)
return true;
- if (offset + sizeof(uint) > b->tableOffset)
+ if (offset + sizeof(uint) > b->tableOffset || offset < (int)sizeof(Base))
return false;
int s = usedStorage(b);
- if (!s)
- return true;
if (s < 0 || s > (int)b->tableOffset - offset)
return false;
if (type == QJsonValue::Array)
diff --git a/src/corelib/serialization/qjson_p.h b/src/corelib/serialization/qjson_p.h
index 7743382806..dc56a49084 100644
--- a/src/corelib/serialization/qjson_p.h
+++ b/src/corelib/serialization/qjson_p.h
@@ -450,7 +450,7 @@ static inline void copyString(char *dest, const QString &str, bool compress)
/*
- Base is the base class for both Object and Array. Both classe work more or less the same way.
+ Base is the base class for both Object and Array. Both classes work more or less the same way.
The class starts with a header (defined by the struct below), then followed by data (the data for
values in the Array case and Entry's (see below) for objects.
diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp
index 9794bca60d..ab27b45fda 100644
--- a/src/corelib/serialization/qjsondocument.cpp
+++ b/src/corelib/serialization/qjsondocument.cpp
@@ -210,6 +210,9 @@ QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidat
return QJsonDocument();
}
+ if (size < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)))
+ return QJsonDocument();
+
QJsonPrivate::Data *d = new QJsonPrivate::Data((char *)data, size);
d->ownsData = false;
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index eb56b31348..18684caefb 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -219,9 +219,8 @@
// AVX intrinsics
# if defined(__AVX__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) && (defined(Q_CC_INTEL) || defined(Q_CC_MSVC))
// AES, PCLMULQDQ instructions:
-// All processors that support AVX support AES, PCLMULQDQ
-// (but neither MSVC nor the Intel compiler define these macros)
-# define __AES__ 1
+// All processors that support AVX support PCLMULQDQ
+// (but neither MSVC nor the Intel compiler define this macro)
# define __PCLMUL__ 1
# endif
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 3858b4b21f..9a9b5be302 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1433,7 +1433,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
if (!key->d->fromEVP_PKEY(pkey)) {
qCWarning(lcSsl, "Unable to convert private key");
q_OPENSSL_sk_pop_free(reinterpret_cast<OPENSSL_STACK *>(ca),
- reinterpret_cast<void (*)(void *)>(q_OPENSSL_sk_free));
+ reinterpret_cast<void (*)(void *)>(q_X509_free));
q_X509_free(x509);
q_EVP_PKEY_free(pkey);
q_PKCS12_free(p12);
@@ -1448,8 +1448,6 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
*caCertificates = QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(ca);
// Clean up
- // TODO: verify ASAP, in the past we had sk_pop_free with q_OPENSSL_sk_free
- // which seems to be blatantly wrong and even crashes with 1.1.
q_OPENSSL_sk_pop_free(reinterpret_cast<OPENSSL_STACK *>(ca),
reinterpret_cast<void (*)(void *)>(q_X509_free));
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index bbaaf43ebb..5faeca0618 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -437,16 +437,15 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory<QFontEngineFT>::fontEngine(const
{
CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(usrPtr);
- if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) {
+ if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
+ QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
+ return QFontEngineFT::create(*fontData, fontDef.pixelSize,
+ static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
+ } else if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) {
Q_ASSERT(url.fileURL);
QFontEngine::FaceId faceId;
faceId.filename = QString::fromNSString(url.path).toUtf8();
return QFontEngineFT::create(fontDef, faceId);
-
- } else if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
- QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
- return QFontEngineFT::create(*fontData, fontDef.pixelSize,
- static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
}
Q_UNREACHABLE();
}
diff --git a/src/plugins/platforms/qnx/qqnxkeytranslator.h b/src/plugins/platforms/qnx/qqnxkeytranslator.h
index 043e38fec9..9400b88dbb 100644
--- a/src/plugins/platforms/qnx/qqnxkeytranslator.h
+++ b/src/plugins/platforms/qnx/qqnxkeytranslator.h
@@ -48,179 +48,68 @@
QT_BEGIN_NAMESPACE
-Qt::Key keyTranslator( int key )
+int qtKeyForPrivateUseQnxKey( int key )
{
switch (key) {
- case KEYCODE_PAUSE:
- return Qt::Key_Pause;
-
- case KEYCODE_SCROLL_LOCK:
- return Qt::Key_ScrollLock;
-
- case KEYCODE_PRINT:
- return Qt::Key_Print;
-
- case KEYCODE_SYSREQ:
- return Qt::Key_SysReq;
-
+ case KEYCODE_PAUSE: return Qt::Key_Pause;
+ case KEYCODE_SCROLL_LOCK: return Qt::Key_ScrollLock;
+ case KEYCODE_PRINT: return Qt::Key_Print;
+ case KEYCODE_SYSREQ: return Qt::Key_SysReq;
// case KEYCODE_BREAK:
-
- case KEYCODE_ESCAPE:
- return Qt::Key_Escape;
-
- case KEYCODE_BACKSPACE:
- return Qt::Key_Backspace;
-
- case KEYCODE_TAB:
- return Qt::Key_Tab;
-
- case KEYCODE_BACK_TAB:
- return Qt::Key_Backtab;
-
- case KEYCODE_RETURN:
- return Qt::Key_Return;
-
- case KEYCODE_CAPS_LOCK:
- return Qt::Key_CapsLock;
-
- case KEYCODE_LEFT_SHIFT:
- case KEYCODE_RIGHT_SHIFT:
- return Qt::Key_Shift;
-
- case KEYCODE_LEFT_CTRL:
- case KEYCODE_RIGHT_CTRL:
- return Qt::Key_Control;
-
- case KEYCODE_LEFT_ALT:
- case KEYCODE_RIGHT_ALT:
- return Qt::Key_Alt;
-
- case KEYCODE_MENU:
- return Qt::Key_Menu;
-
- case KEYCODE_LEFT_HYPER:
- return Qt::Key_Hyper_L;
-
- case KEYCODE_RIGHT_HYPER:
- return Qt::Key_Hyper_R;
-
- case KEYCODE_INSERT:
- return Qt::Key_Insert;
-
- case KEYCODE_HOME:
- return Qt::Key_Home;
-
- case KEYCODE_PG_UP:
- return Qt::Key_PageUp;
-
- case KEYCODE_DELETE:
- return Qt::Key_Delete;
-
- case KEYCODE_END:
- return Qt::Key_End;
-
- case KEYCODE_PG_DOWN:
- return Qt::Key_PageDown;
-
- case KEYCODE_LEFT:
- return Qt::Key_Left;
-
- case KEYCODE_RIGHT:
- return Qt::Key_Right;
-
- case KEYCODE_UP:
- return Qt::Key_Up;
-
- case KEYCODE_DOWN:
- return Qt::Key_Down;
-
- case KEYCODE_NUM_LOCK:
- return Qt::Key_NumLock;
-
- case KEYCODE_KP_PLUS:
- return Qt::Key_Plus;
-
- case KEYCODE_KP_MINUS:
- return Qt::Key_Minus;
-
- case KEYCODE_KP_MULTIPLY:
- return Qt::Key_Asterisk;
-
- case KEYCODE_KP_DIVIDE:
- return Qt::Key_Slash;
-
- case KEYCODE_KP_ENTER:
- return Qt::Key_Enter;
-
- case KEYCODE_KP_HOME:
- return Qt::Key_Home;
-
- case KEYCODE_KP_UP:
- return Qt::Key_Up;
-
- case KEYCODE_KP_PG_UP:
- return Qt::Key_PageUp;
-
- case KEYCODE_KP_LEFT:
- return Qt::Key_Left;
-
- // Is this right?
- case KEYCODE_KP_FIVE:
- return Qt::Key_5;
-
- case KEYCODE_KP_RIGHT:
- return Qt::Key_Right;
-
- case KEYCODE_KP_END:
- return Qt::Key_End;
-
- case KEYCODE_KP_DOWN:
- return Qt::Key_Down;
-
- case KEYCODE_KP_PG_DOWN:
- return Qt::Key_PageDown;
-
- case KEYCODE_KP_INSERT:
- return Qt::Key_Insert;
-
- case KEYCODE_KP_DELETE:
- return Qt::Key_Delete;
-
- case KEYCODE_F1:
- return Qt::Key_F1;
-
- case KEYCODE_F2:
- return Qt::Key_F2;
-
- case KEYCODE_F3:
- return Qt::Key_F3;
-
- case KEYCODE_F4:
- return Qt::Key_F4;
-
- case KEYCODE_F5:
- return Qt::Key_F5;
-
- case KEYCODE_F6:
- return Qt::Key_F6;
-
- case KEYCODE_F7:
- return Qt::Key_F7;
-
- case KEYCODE_F8:
- return Qt::Key_F8;
-
- case KEYCODE_F9:
- return Qt::Key_F9;
-
- case KEYCODE_F10:
- return Qt::Key_F10;
-
- case KEYCODE_F11:
- return Qt::Key_F11;
-
- case KEYCODE_F12:
- return Qt::Key_F12;
+ case KEYCODE_ESCAPE: return Qt::Key_Escape;
+ case KEYCODE_BACKSPACE: return Qt::Key_Backspace;
+ case KEYCODE_TAB: return Qt::Key_Tab;
+ case KEYCODE_BACK_TAB: return Qt::Key_Backtab;
+ case KEYCODE_RETURN: return Qt::Key_Return;
+ case KEYCODE_CAPS_LOCK: return Qt::Key_CapsLock;
+ case KEYCODE_LEFT_SHIFT: return Qt::Key_Shift;
+ case KEYCODE_RIGHT_SHIFT: return Qt::Key_Shift;
+ case KEYCODE_LEFT_CTRL: return Qt::Key_Control;
+ case KEYCODE_RIGHT_CTRL: return Qt::Key_Control;
+ case KEYCODE_LEFT_ALT: return Qt::Key_Alt;
+ case KEYCODE_RIGHT_ALT: return Qt::Key_Alt;
+ case KEYCODE_MENU: return Qt::Key_Menu;
+ case KEYCODE_LEFT_HYPER: return Qt::Key_Hyper_L;
+ case KEYCODE_RIGHT_HYPER: return Qt::Key_Hyper_R;
+ case KEYCODE_INSERT: return Qt::Key_Insert;
+ case KEYCODE_HOME: return Qt::Key_Home;
+ case KEYCODE_PG_UP: return Qt::Key_PageUp;
+ case KEYCODE_DELETE: return Qt::Key_Delete;
+ case KEYCODE_END: return Qt::Key_End;
+ case KEYCODE_PG_DOWN: return Qt::Key_PageDown;
+ case KEYCODE_LEFT: return Qt::Key_Left;
+ case KEYCODE_RIGHT: return Qt::Key_Right;
+ case KEYCODE_UP: return Qt::Key_Up;
+ case KEYCODE_DOWN: return Qt::Key_Down;
+ case KEYCODE_NUM_LOCK: return Qt::Key_NumLock;
+ case KEYCODE_KP_PLUS: return Qt::Key_Plus;
+ case KEYCODE_KP_MINUS: return Qt::Key_Minus;
+ case KEYCODE_KP_MULTIPLY: return Qt::Key_Asterisk;
+ case KEYCODE_KP_DIVIDE: return Qt::Key_Slash;
+ case KEYCODE_KP_ENTER: return Qt::Key_Enter;
+ case KEYCODE_KP_HOME: return Qt::Key_Home;
+ case KEYCODE_KP_UP: return Qt::Key_Up;
+ case KEYCODE_KP_PG_UP: return Qt::Key_PageUp;
+ case KEYCODE_KP_LEFT: return Qt::Key_Left;
+ case KEYCODE_KP_FIVE: return Qt::Key_5;
+ case KEYCODE_KP_RIGHT: return Qt::Key_Right;
+ case KEYCODE_KP_END: return Qt::Key_End;
+ case KEYCODE_KP_DOWN: return Qt::Key_Down;
+ case KEYCODE_KP_PG_DOWN: return Qt::Key_PageDown;
+ case KEYCODE_KP_INSERT: return Qt::Key_Insert;
+ case KEYCODE_KP_DELETE: return Qt::Key_Delete;
+ case KEYCODE_F1: return Qt::Key_F1;
+ case KEYCODE_F2: return Qt::Key_F2;
+ case KEYCODE_F3: return Qt::Key_F3;
+ case KEYCODE_F4: return Qt::Key_F4;
+ case KEYCODE_F5: return Qt::Key_F5;
+ case KEYCODE_F6: return Qt::Key_F6;
+ case KEYCODE_F7: return Qt::Key_F7;
+ case KEYCODE_F8: return Qt::Key_F8;
+ case KEYCODE_F9: return Qt::Key_F9;
+ case KEYCODE_F10: return Qt::Key_F10;
+ case KEYCODE_F11: return Qt::Key_F11;
+ case KEYCODE_F12: return Qt::Key_F12;
// See keycodes.h for more, but these are all the basics. And printables are already included.
@@ -231,7 +120,21 @@ Qt::Key keyTranslator( int key )
break;
}
- return Qt::Key_Escape;
+ return Qt::Key_unknown;
+}
+
+QString keyStringForPrivateUseQnxKey( int key )
+{
+ switch (key) {
+ case KEYCODE_ESCAPE: return QStringLiteral("\x1B");
+ case KEYCODE_BACKSPACE: return QStringLiteral("\b");
+ case KEYCODE_TAB: return QStringLiteral("\t");
+ case KEYCODE_RETURN: return QStringLiteral("\r");
+ case KEYCODE_DELETE: return QStringLiteral("\x7F");
+ case KEYCODE_KP_ENTER: return QStringLiteral("\r");
+ }
+
+ return QString();
}
bool isKeypadKey( int key )
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index c6b5bd7396..2a5c2087fb 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -58,6 +58,37 @@
#define qScreenEventDebug QT_NO_QDEBUG_MACRO
#endif
+static int qtKey(int virtualKey, QChar::Category category)
+{
+ if (Q_UNLIKELY(category == QChar::Other_NotAssigned))
+ return virtualKey;
+ else if (category == QChar::Other_PrivateUse)
+ return qtKeyForPrivateUseQnxKey(virtualKey);
+ else
+ return QChar::toUpper(virtualKey);
+}
+
+static QString keyString(int sym, QChar::Category category)
+{
+ if (Q_UNLIKELY(category == QChar::Other_NotAssigned)) {
+ return QString();
+ } else if (category == QChar::Other_PrivateUse) {
+ return keyStringForPrivateUseQnxKey(sym);
+ } else {
+ uint ucs4_sym = sym;
+ return QString::fromUcs4(&ucs4_sym, 1);
+ }
+}
+
+static QString capKeyString(int cap, int modifiers, int key)
+{
+ if (cap >= 0x20 && cap <= 0x0ff) {
+ if (modifiers & KEYMOD_CTRL)
+ return QChar((int)(key & 0x3f));
+ }
+ return QString();
+}
+
QT_BEGIN_NAMESPACE
QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
@@ -154,6 +185,13 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie
{
Q_UNUSED(scan);
+ if (!(flags & KEY_CAP_VALID))
+ return;
+
+ // Correct erroneous information.
+ if ((flags & KEY_SYM_VALID) && sym == static_cast<int>(0xFFFFFFFF))
+ flags &= ~(KEY_SYM_VALID);
+
Qt::KeyboardModifiers qtMod = Qt::NoModifier;
if (modifiers & KEYMOD_SHIFT)
qtMod |= Qt::ShiftModifier;
@@ -161,37 +199,20 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie
qtMod |= Qt::ControlModifier;
if (modifiers & KEYMOD_ALT)
qtMod |= Qt::AltModifier;
+ if (isKeypadKey(cap))
+ qtMod |= Qt::KeypadModifier;
- // determine event type
QEvent::Type type = (flags & KEY_DOWN) ? QEvent::KeyPress : QEvent::KeyRelease;
- // Check if the key cap is valid
- if (flags & KEY_CAP_VALID) {
- Qt::Key key;
- QString keyStr;
+ int virtualKey = (flags & KEY_SYM_VALID) ? sym : cap;
+ QChar::Category category = QChar::category(virtualKey);
+ int key = qtKey(virtualKey, category);
+ QString keyStr = (flags & KEY_SYM_VALID) ? keyString(sym, category) :
+ capKeyString(cap, modifiers, key);
- if (cap >= 0x20 && cap <= 0x0ff) {
- key = Qt::Key(std::toupper(cap)); // Qt expects the CAP to be upper case.
-
- if ( qtMod & Qt::ControlModifier ) {
- keyStr = QChar((int)(key & 0x3f));
- } else {
- if (flags & KEY_SYM_VALID)
- keyStr = QChar(sym);
- }
- } else if ((cap > 0x0ff && cap < UNICODE_PRIVATE_USE_AREA_FIRST) || cap > UNICODE_PRIVATE_USE_AREA_LAST) {
- key = (Qt::Key)cap;
- keyStr = QChar(sym);
- } else {
- if (isKeypadKey(cap))
- qtMod |= Qt::KeypadModifier; // Is this right?
- key = keyTranslator(cap);
- }
-
- QWindowSystemInterface::handleExtendedKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod,
- scan, sym, modifiers, keyStr);
- qScreenEventDebug() << "Qt key t=" << type << ", k=" << key << ", s=" << keyStr;
- }
+ QWindowSystemInterface::handleExtendedKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod,
+ scan, virtualKey, modifiers, keyStr);
+ qScreenEventDebug() << "Qt key t=" << type << ", k=" << key << ", s=" << keyStr;
}
void QQnxScreenEventHandler::setScreenEventThread(QQnxScreenEventThread *eventThread)
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 9f5b739230..d93e71e32f 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -858,7 +858,7 @@ void QDialogButtonBoxPrivate::_q_handleButtonClicked()
if (!guard)
return;
- switch (buttonRole) {
+ switch (QPlatformDialogHelper::ButtonRole(buttonRole)) {
case QPlatformDialogHelper::AcceptRole:
case QPlatformDialogHelper::YesRole:
emit q->accepted();