diff options
authorVova Mshanetskiy <>2019-05-07 15:26:32 +0300
committerVova Mshanetskiy <>2019-05-10 20:24:07 +0000
commit341c9106881810962f253c1502d2c4f6da90e149 (patch)
parentc905ff4392ee0f71b5b003ee3ed4fa42f4e3f8f1 (diff)
Android: Fix wrong height of text editor context menu in some locales
Combined width of all four buttons (cut, copy, paste, select all) is greater than width of the screen in some locales and/or on some devices. This was causing width of the last button to be set to zero and height of the whole popup to grow too much due to word wrapping in the last button. The context menu used to look something like this then: Cut Copy Paste S e l e c t a l l This commit disables word wrapping and enables text ellipsizing for button labels. This fixes height of the popup. In the long term though Qt will probably have to implement an overflow button like in Android's built context menu. The linked bug report contains before and after screenshots. Fixes: QTBUG-72933 Change-Id: I8e270dbf8ca66f99748cdc531a77e11a5ab11c2b Reviewed-by: BogDan Vatra <>
1 files changed, 4 insertions, 1 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/ b/src/android/jar/src/org/qtproject/qt5/android/
index 6d9987ca2a..104132934d 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/
+++ b/src/android/jar/src/org/qtproject/qt5/android/
@@ -41,6 +41,7 @@ package;
import android.content.Context;
+import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -73,7 +74,7 @@ public class EditContextView extends LinearLayout implements View.OnClickListene
m_buttonId = stringId;
setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
+ ViewGroup.LayoutParams.WRAP_CONTENT, 1));
@@ -81,6 +82,8 @@ public class EditContextView extends LinearLayout implements View.OnClickListene
int hPadding = (int)(16 * scale + 0.5f);
int vPadding = (int)(8 * scale + 0.5f);
setPadding(hPadding, vPadding, hPadding, vPadding);
+ setSingleLine();
+ setEllipsize(TextUtils.TruncateAt.END);