How to add the common navigation bar to a Meego app?

424 views Asked by At

When using the Meego Touch Framework, the standard MApplicationWindow has the common navigation bar (with the switcher, menu and close buttons) already attached.

For example, the following code:

#include <MApplication>
#include <MApplicationWindow>

int main(int argc, char *argv[]){
    MApplication app(argc, argv);
    MApplicationWindow w;
    w.show();
    return app.exec();
}

Creates a blank window with a menu bar that looks similar to this (eg. the switcher button, menu and close button along the top).

However, since the the docs discourage the use of the Touch Framework I want to avoid using it, so how would I create a similar looking window using only the standard API?

2

There are 2 answers

2
Gerstmann On BEST ANSWER

How I would implement this, would probably be a fixed height, variable width QHBoxLayout with a stretch factor for those indices that need it. Then I would just use QPushButton and QCombobBox for the widgets and finish them off with a custom stylesheet and icons. I would then wrap these inside a neat little custom widget that I could reuse in my main view class.

The main view should be a window class that would hold the navigation bar widget on top of a QVBoxLayout, and the actual content below it. The bottom index would have a stretch factor to it, so that the upper index would always be at the top.

I don't quite remember how the Meego handset UX should act like, but that's how I would create a similar looking navigation bar.

0
Kurt Pattyn On

I would just go with the QMainWindow class, as this class already has menus, toolbars, statusbar aso.
You should however take care of the orientation switching yourself (I see that the toolbar in portrait mode is at the bottom, while in landscape mode it is on the top).
This could be accomplished by setting the right Qt::ToolbarArea value.

The style of the buttons and the window itself, can be set using a Qt stylesheet.