Mac right-to-left issue



  • All,

    I'm seeing some different behavior on Mac OSX (when compared to Windows) with regards to right-to-left layout direction. It's hard to believe the following is broken:

    @
    #include <QtGui/QComboBox>
    #include <QtGui/QApplication>
    #include <QtGui/QVBoxLayout>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    a.setLayoutDirection(Qt::RightToLeft);

    QWidget w;
    QVBoxLayout *layout = new QVBoxLayout();
    QComboBox *comboBox = new QComboBox(&w);
            
    layout->addWidget(comboBox);
            
    w.setLayout(layout);
    w.setMinimumWidth(300);
    w.show();
    
    comboBox->insertItems(0, QStringList()
                      << "This is a test"
                    << "This is a second test");
    
    return a.exec&#40;&#41;;
    

    }
    @

    On Windows, the layout is right-to-left as expected. On Mac, the layout is still left-to-right. I'm using Qt 4.7.2 (Cocoa) on OSX Lion (10.7.2). I'm compiling with XCode 4.2.1. Is anyone seeing anything similar?



  • Does it change anything forcing the layout direction even on the vertical layout too? Could be a problem of layout parenting? Just thinking...



  • Is this the cause of your problem?

    bq. From "QWidget docs/layoutDirection":http://doc.qt.nokia.com/4.7/qwidget.html#layoutDirection-prop:
    This method no longer affects text layout direction since Qt 4.7.



  • [quote author="fluca1978" date="1322756049"]Does it change anything forcing the layout direction even on the vertical layout too? Could be a problem of layout parenting? Just thinking...[/quote]

    It doesn't change anything...

    [quote author="Volker" date="1322756776"]Is this the cause of your problem?

    bq. From "QWidget docs/layoutDirection":http://doc.qt.nokia.com/4.7/qwidget.html#layoutDirection-prop:
    This method no longer affects text layout direction since Qt 4.7.[/quote]

    I think that's for widgets. However in my code I'm setting it for the entire application. Not sure if there is a difference.



  • The application setting is just the default for the widgets.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.