[Qt-interest] Qt::LayoutDirection and language

Diego Iastrubni diegoiast at gmail.com
Wed May 12 21:15:53 CEST 2010


On Wed, May 12, 2010 at 7:05 PM, Robert Hairgrove <evorgriahr at hispeed.ch>wrote:

> There is no interface, however (AFAICT) to query the locale or the
> language to get the reading direction at runtime.


Sure there is, If you don't understand this from the followin lines, please
re-ask and I will give you a better hint ;-)

[elcuco at pinky ~/qtsdk-2010.02] grep  setLayoutDirection
qt/src/gui/kernel/qapplication.cpp
            QApplication::setLayoutDirection(Qt::RightToLeft);

 setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight);
    Use setLayoutDirection() instead.
void QApplication::setLayoutDirection(Qt::LayoutDirection direction)

static bool qt_detectRTLLanguage()
{
    return force_reverse ^
        (QApplication::tr("QT_LAYOUT_DIRECTION",
                         "Translate this string to the string 'LTR' in
left-to-right"
                         " languages or to 'RTL' in right-to-left languages
(such as Hebrew"
                         " and Arabic) to get proper widget layout.") ==
QLatin1String("RTL"));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100512/b9d7bbc2/attachment.html 


More information about the Qt-interest-old mailing list