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?
Related
I use Qt designer (as opposed to building controls via the program) to lay out my sidebar and floating dialogs. When first launching the application, the sidebar is WAY too wide and bears no resemblance to how I saved it. The user can shrink it to a reasonable width, and that is 'remembered' after closing and re-opening the application. But it doesn't create a good first impression of our application, and not all our users are savvy enough to realize that the sidebar width can be changed.
The sidebar is quite complex, with multiple forms (QStackedWidget) and each with multiple controls. Any suggestions for forcing it to come up at the minimum width with the first use? Thanks!
You should be able to achieve the wanted behavior by setting "Horizontal Stretch" property in Qt Designer, for each of the widgets in your splitter or layout, whichever you are using to layout your components. See QSizePolicy documentation for more info.
The "Horizontal Stretch" & "Vertical Stretch" properties are located in Qt Designers Property Editor, under the sizePolicy.See the image for exact location of properties
I'm working on application for embedded and we have 256x64 grayscale screen. Qt 5.3 perfectly renders on that screen with -platform linuxfb option. Obviously, we save every pixel of space, so I faced with trouble: Qt Designer adds excess 1 pixel spacing for every layout element deeper in hierarchy. So they accumulate for the most deep widgets. More precisely, for some reason child element of layout components gets coordinates (1,1) relative to parent. So, it's true for every widget except for root widget. Picture below demonstrates accumulated spacings (thin and thick red lines), and (1,1) coordinates of the very first child widget.
I believe it's Qt behavior itself, not just Qt Designer issue (not tested yet). But I can't work further even if it's shown in Designer only: I need to have pixel-exact view while designing.
Of course, every spacing and margin of every component in form set to 0.
Manual coordinates assigning (from code) eliminates the problem of course, but I need to generate code by uic.
So, my question is: how to avoid such spacings? Fixing Qt core sources can be (hard) option too, since anyway we recompile Qt for the project.
Mirror post on Qt forums
Thanks.
Ilia.
If you select Form > View Code, you can see that the geometry is not actually used for widgets which are inside a layout. So the numbers you see in the Property Editor are purely informational and have no relevance to the eventual code that is generated from the ui file (which is why they are greyed out).
The one pixel offset is there because Qt Designer needs space to draw the red boxes around layouts. They have to be be represented somehow, so I don't see how this can be avoided given the way Qt Designer currently works. If you want a more accurate reprentation of the final results, I suppose you will have to show a preview.
There is a facility in Settings > Preferences > Embedded Design that allows you to specify device profiles (which determine things like style, font, and screen resolution). This will add a new entry to the Preview In menu, which should allow you to refine the accuracy of the previews even further.
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?
can someone tell me what is the meaning of the icons in the title bar? A rocket, a plus, a star.. Im very curious.
Look at the file names of the icons. The first component describes the meaning: https://github.com/awesomeWM/awesome/tree/master/themes/default/titlebar
The plus is for sticky windows. These are windows which are visible on all tags (normally windows are only visible if one of their tags is selected).
The star is for ontop. These windows ignore the normal stacking order and are ontop of everything else.
The rocket is for maximized windows. These windows ignore the current layout and use all the available space.
The arrow is for floating windows. These windows also ignore the current layout, but they can be freely resized to any size.
The cross is a close button. It closes windows! ;-)
I have a hebrew locale configured in my computer and for some reason this makes QT designer mirror its entire interface to be aligned from right to left.
This is horrible and makes the designer useless for me.
Is there a way in run-time to make the designer not mirror its GUI elements? a menu item or an environment variable or something?
Did you try to run designer with the option "-reverse", that could solve your problem.
If the locale is "french", and I run with "-reverse" all the layouts become right to left aligned, so maybe if the locale is "hebrew", the layouts will become left to right.