Qt : Strings display incorrectly in rtl layout - qt

i'm writing a qt app that should use right to left layout but there is a problem with displaying strings that include space,digits and letters in qtreewidget and qtablewidget. for example when i write 65 %c it shows as c% 65 and of course date times shown as "22:10:06 2015-01-06" instead of "2015-01-06 22:10:06"
how can i fix this?
screenshot:
thank you

When you use rtl layout all children assume that your writing language is also rtl.
Digits are universal so they are treated depending on this setting.
When you use ltr characters (Latin for example) this gives this "funny" side effect (it is even more funny when you edit this text, cursor will jump to different position when moved by arrows).
One way to fix it is add Unicode Left-to-right mark characters where it is needed.
IMO it would be better do not use this feature (rtl layout) if your language is ltr. Let locale setting do this magic.
Can you explain how and why did you used "rtl layout"? What did you tried to achieve that you have decided ti change text direction?

Related

How to make bootstraps's "split button" in Qt widgets

This is probably simple, though I can't find the correct CSS trick to handle this one.
I want to have this kind of button-group (separated with lines, containing a context menu ) in Qt. They must have native look and feel (not like below examples) so the only needed change seems to be removing rounded corners of a QPushButton from its right side (for left-most button), left side (for right most button) and both (for buttons in the middle).
Qt does not support this. You can use CSS to style the buttons like in the example, but you can not use natively styled buttons like this.
If you really need this, the only option I see is to write custom controls for this, with customized drawing code for each OS GUI style you want to support.
You could also try to use standard buttons that overlap and use custom code to paint some kind of line over the overlapping region, but I don't think that would be a good solution.

Automatic double quotes,parenthesis etc. with Brackets editor

I'm using the "Brackets" from Adobe as my main web design code editor. The problem i have is when i want to type two quotes or parentheses etc. In sublime for example i just have to press only the left parentheses and it will automatically type the right one for me and put the cursor in the middle.
But in "Brackets" i have to type the left and the right and then manually with my arrow keys put the cursor in the middle. I have installed lots of extensions but with no luck. Is there any solution for this? Thanks.
Check off Edit > Auto Close Braces in the menu.

How can I ellipsis a Text in BB 10 Cascades?

I'm developing a BlackBerry 10 mobile application using the Momentics IDE (native SDK).
I have a Label which has fixed width. If a Text does not fit in this Label, I want it to be ellipsis (elliding the text with the conventional "..." at the end) in place of a fade effect (just sort of "ghosts" into oblivion) like the Cascades designers have chosen to be in such case like presented in the image below.
Can any one help me on this ?
Since Peter doesn't seem to know how to do this in a straight forward way, the only option left would seem to be the complicated way. You may, of course, create your own control and manage the text rendering in the way you would like using an ellipsis instead of the fade. That would seem to be a great deal of work for what in the end will really only result in your program being unconventional on the platform.
Edit:
Since you think it is worth a bounty I will add the following thought.
Using the ellipsis method, instead of the fade method, may impose a performance penalty on your application. Elliding text requires the computation of how many characters may be displayed int the available area and still leave room for the ellipsis. This is not a trivial mater with variable width type faces or different character sets. The fade, on the other hand, is a simple transparency operation. Since UI graphics operations in Cascades are all done in hardware the fade is quite efficient and independent of the size of the string, text area, type face, etc.
Which version of QML? QML element Text has elide property and this is what you want.

Qt: layout direction changes with locale?

It appears that starting with Qt 4.7 the layout direction of all GUI elements is now controlled by the locale. When my locale is a right-to-left one, all menus, dialogs, message boxes etc' appear from right to left. This is horrible.
The default locale in my computer is Hebrew because it is convenient to see dates and numbers in the local format but I most certainly don't want all my GUI to now be Right-To-Left.
Why did they do this all-encompassing change? Is there any way to turn it off globally?

How can I force vertical text to be horizontal?

I'm working on an ASP.NET website that needs to be internationalized. I'm using .resx files (essentially key-value pairs in a file) to populate static string fields on a page in different languages depending on the chosen culture/locale. I'm implementing Japanese and getting some stubborn vertical strings.
When copy and pasting them into the .resx file, they are horizontal (source of strings is Google Translate, for testing purposes). All of the strings appear normal, but one always displays vertically. The misbehaving string is a few div's deep (like all of them) and only has font-size, font-family, color, and an uppercase transform applied to it.
Removing any or all of the above rules does not change the orientation of the text. I've cleaned the formatting off the offending text with Notepad and shortened it (to ensure it wasn't a length problem). I'm stumped as to why this particular string is stubbornly vertical.
Here is the text in question: ログアウト
(Translation: Logout)
Edit
Clarification of the issue.
What it should look like:
The vertical text in question:
How can I force vertical text to be
horizontal?
Other than the title, I don't really understand your question. I'll take a guess anyway.
Try adding white-space: nowrap to the div that's misbehaving.
Recently I was doing some learning about right-to-left on the web and learned that Unicode characters have a directional property associated with them at the character level. So this might have something to do with that, though I certanily wouldn't know how to ascertain that or fix it, especially given that Google Translate is the source of the strings.
It happens quite often for Asian scripts (not just Japanese but also Korean and Chinese) to have text rendered incorrectly. Usually you just need to play with element width, especially if it is part of HTML table.

Resources