Draw a qlabel mirrored - android

I want to create a HUD speed counter using Qt and my smartphone. I can get speed via gps information, the issue is when I display it on the screen, I can't manage to display the QLabel mirrored.
So here's my question : Who can I write from right to left ?

As asked by Samoth i post my comment as an answer ;)
This is helpful resource for mirroring QLabel: http://qtcentre.org/archive/index.php/t-8248.html

Not sure if it answers your question. The following resources demonstrate how to display RightToLeft Text in Qt / QLabel:
Qt 4.7 Desktop application support for right-to-left UI (Hebrew)
Display a Hebrew RTL label - howto?

Related

Create transparent form

I work with FireMonkey in C++Builder, and I'm trying to make a transparent form, so that the components that are on it are displayed, but in the space where there are no components you can see what is below the form (transparent)...
I have set the Transparency property of the form to true, but the areas of the form that should be transparent look BLACK.
I have searched the Internet and found solutions for Delphi, but none for C++.
I tried to include this in the manifest:
SetActivityAttribute(MYFormTransparent ,android:theme, #android:style/Theme.Translucent.NoTitleBar)
but still, the same issue.
Any ideas?
This is a known problem that was introduced in 10.3 Rio. It has already been reported to Embarcadero (unfortunately, it has been closed as "works as expected"):
RSP-22314: Transparency Property
Marco Cantu commented on that report:
Sorry for not commenting sooner. We have done some research on it for the last update, but decided to defer a fix.
The core issue (in short) is that we use Android SurfaceView and this is a limitation of that platform control (only 2 SurfaceView instances are available). We are using this platform element as it allows us to mix styled and platforms controls (a feature we introduced in 10.30). By chancing the internal implementation, the transparency become unavailable.
There is an alternative implementation of forms via TextureView, but so far our tests have shown that the speed of rendering 2 times slower, and we don't want to slow down all FMX applications on Android for this feature.
There are some workarounds, one of them is to use a frame instead of a form. It works perfectly with transparency and uses less resources than separate form.
For existing code the fast way is to add a Layout to the form and have the controls inside it. When you need to display the form with transparency you can just move Layout from the specific form to main form as a child and align it on content Align = Content.
Other commenters noted:
I tested an alternative with formStyle = popup and stylelookup = popupboxstyle
with a rectangle in the form with transparency = 0.4 and some instructions to size the form with setBounds
The result is acceptable
As said by Herve Escriou, a work around is to set your formstyle property of the form to "Popup". This will make the form transparent again. But this wil have the effect of the wsMaximized style not working properly. You can go around this by making the following code additions to your form: ...

Android font-size brakes UI

On my web project I encountered a problem with android phones. If you just browse a page with default settings all is fine, but if in Settings > Display > Font > I change font-size to e.g. Huge then my UI elements become scaled.
I style my elements using em's mostly.
I tried fixes on topic of font boosting:
html * {max-height:9999999px}
or
text-size-adjust: none
In short, imagine I have 4 buttons stacked at the bottom of the screen horizontally. When I change the font size in android settings the buttons become huge and overlap each other, hence breaking the UI
Please help. :)
UPDATE
The accepted answer suggests that is is not possible from a css/js perspective. There may be some crazy hacks, but nothing worth thinking about for me. So if anyone finds a solution, please do post an answer.
This is expected behavior from Android Accessibility options.
As far as my knowledge goes there is no way to hack that from external css/js in the browser.
If you have a standalone app you can extend the WebView class and do getSettings().setTextZoom(100) which would ignore the text size from Accessibility.
In CSS em unit is relative to the font-size of the element (2em means 2 times the size of the current font).
Which means that it's dependent of the user's font settings.
The solution to your problem is to use another unit, like vw, which is relative the screen (viewport) width, 9vw ~ 9% of viewport width.
Or simply use an independent unit like pixels (px).
More about CSS units can be found here: http://www.w3schools.com/cssref/css_units.asp.

Firemonkey: label cutting accentuation

I'm developing an app for android using Rad Studio 10.1 and I'm having trouble with a new font that I'm trying to implement into my project. The problem is, I have to use accentuation in my app because is for portuguese language users, and portuguese has a lot of accentuation. I found a good font on the internet and I want to use, but when I put into a label, the label cuts the top part of the text. An image to explain better:
As you can see, just the accentuation of the top are being cutted, should be a 'Ã'. The bottom accentuation 'Ç' are just normal, and this just happen with UpperCase texts. Someone have any idea why this is happening?
EDIT: Aditional information: The TLabel is alredy set on Client Alignment

Text cut off for TText Controls Delphi xe5 Android

Developing for Android via Delphi xe5.Text on TText and TLabel controls are not displaying properly. Seems as if the last line of text is being cut short per character.
This is my issue i believe but not applicable to Delphi xe5
Android: Last line of textview cut off
Here is a QC report I found describing my issue.
http://qc.embarcadero.com/wc/qcmain.aspx?d=121356
Note: The workaround listed in the QC report does not work for me because I am dynamically creating a lot of text controls ( thus can not create in design builder ) and changing the autosize property does not do anything for me.
Any work around or way to resolve this issue? Text displays correctly for iOS, but not for Android.
Thanks !

Right to Left support for TextView in Android

I'm developing an application for Android in Persian. I fetch data from SQLite database and display them, using TextView. How can I display the text (that contains multiple lines ) from right to left?
Any Idea?
If the ROM supports right-to-left, which is most likely the case if you bought your mobile in the middle east, then you can set the gravity to right.
If Android does not support this natively (I'm not sure), you could create a string reverser that swaps the nth char with the string.length() - nth character until you have a reflected string, and then post that right justified.
If the ROM doesn't support right-to-left rendering, you could possibly use the java.text.Bidi class that implements the Unicode Bidi Algorithm.
This is an old question but since it wasn't asked very good it was not answered.
#Farina, I believe the answer you are looking for is here:
http://developer.android.com/guide/topics/resources/providing-resources.html
In essence: By creating a layout-ar folder right next to your layout folder and placing an rtl oriented layout file in it you can get it to show only on rtl selected devices. (ar stands for Arab, if using a different rtl language you may find the code here. Be-were that some devices support old-deprecated language codes so if it doesn't work try looking for older codes)

Categories

Resources