From 01c11c3006b7b5ef47f6ae8bcfe1483a6a036da7 Mon Sep 17 00:00:00 2001 From: Bartlomiej Moskal Date: Tue, 2 Apr 2024 12:24:33 +0200 Subject: [PATCH] Android: Choose correct icon for QMessageBox QMessageBox contains an icon that can be set using icon type. Before this commit, android.R.attr.alertDialogIcon was used regardless of the expected icon type. Only if setting failed, the icon from android.R.drawable was set (depending on the expected icon type). Previously, usage of android.R.attr.alertDialogIcon was the way to consider Theme in choosing icon view. Since 31a0d99fa565d39bf39f0c3ae5ed00859679a969 commit, getDrawable(id, theme) is used with second parameter: Resources.Theme. Because of that we can start to use only icons from android.R.drawable and remove usage of android.R.attr.alertDialogIcon Fixes: QTBUG-123334 Pick-to: 6.6 6.5 Change-Id: I6cfdaf30aea5d132e38ba5d78054089b51cf5f13 Reviewed-by: Assam Boudjelthia (cherry picked from commit 229cadb7a36694b7ab639047dceb73cf2dfce858) Reviewed-by: Qt Cherry-pick Bot --- .../qtproject/qt/android/QtMessageDialogHelper.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt/android/QtMessageDialogHelper.java b/src/android/jar/src/org/qtproject/qt/android/QtMessageDialogHelper.java index b21f5295581..41b0f6ceb42 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtMessageDialogHelper.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtMessageDialogHelper.java @@ -69,15 +69,6 @@ public class QtMessageDialogHelper if (m_standardIcon == 0) return null; - try { - TypedValue typedValue = new TypedValue(); - m_theme.resolveAttribute(android.R.attr.alertDialogIcon, typedValue, true); - return m_activity.getResources().getDrawable(typedValue.resourceId, - m_activity.getTheme()); - } catch (Exception e) { - e.printStackTrace(); - } - // Information, Warning, Critical, Question switch (m_standardIcon) { @@ -87,7 +78,6 @@ public class QtMessageDialogHelper case 2: // Warning return m_activity.getResources().getDrawable(android.R.drawable.stat_sys_warning, m_activity.getTheme()); -// break; case 3: // Critical return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert, m_activity.getTheme());