QMainWindow layout bug in landscape mode on Symbian S60v5 and Symbian^3



  • When I put many widgets in QMainWindow, it shows them normal in portrait mode, but in landscape mode these widgets are stretching out of the screen and become inaccessible. I've reproduced it on Nokia 5800ExpressMusic and Nokia N8 with the same result. Qt version is 4.6.3.

    Here some screenshots of the sample application: "Portrait mode":http://pixelpipe.com/item/b2199b75-27c6-4338-9247-d3247b51b5f3, "Landscape mode":http://pixelpipe.com/item/4481ea68-2499-4a21-9d85-565e4f88d12e

    Here is the code:

    @
    #include <QApplication>
    #include <QVBoxLayout>
    #include <QPushButton>
    #include <QCheckBox>
    #include <QTextEdit>
    #include <QMainWindow>

    int main (int argc, char * argv[])
    {
    QApplication app(argc, argv);
    QMainWindow wnd;
    QWidget* window = new QWidget;
    QVBoxLayout* layout = new QVBoxLayout(window);
    QPushButton* optsButton = new QPushButton("Options");
    QPushButton* exitButton = new QPushButton("Exit");
    QCheckBox* chkBox = new QCheckBox("Checkbox");
    QTextEdit* textEd1 = new QTextEdit;
    QTextEdit* textEd2 = new QTextEdit;
    layout->addWidget(textEd1);
    layout->addWidget(textEd2);
    layout->addWidget(chkBox);
    layout->addWidget(optsButton);
    layout->addWidget(exitButton);

    QObject::connect(exitButton, SIGNAL(clicked()), &app, SLOT(quit()));

    wnd.setCentralWidget(window);

    #if defined(Q_WS_S60)
    wnd.showMaximized();
    #else
    wnd.show();
    #endif
    return app.exec();
    }
    @

    Is it bug or maybe I'm doing something wrong?

    --
    Best regards,
    VP



  • Hello Vasyl,

    I just wrote "an article":http://developer.symbian.org/wiki/index.php/Apps:About_Qt_List_User_Interfaces about lists on Symbian devices. While the focus is on customizing lists, it also addresses handling a resize event for orientation and laying the widgets properly. You might check it out.

    -hth
    John



  • Use setLayout() method after add widgets to layout. If not, window can't use layout as a layout manager.


Log in to reply
 

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