Navigation bar
A navigation bar is a widget that organizes contents in window- or
application-specific drop down menus which are grouped in a parent menu.
Usually, it is anchored to the top of the screen or a window.
A WNavigationBar consists of one or more
WMenu controls - each working in
conjunction with a WStackedWidget to
manage its contents.
You can still add other kind of widgets to the navigation bar with
addWidget()
.
It is similar to WTabWidget but
it has more features like a title and multiple menus in addition to
a more extensive style class.
In the example below, the title and an optional link is set with the
method setTitle()
.
Especially for mobile applications, you can make the navigation bar
responsive to the available screen size with setResponsive()
.
You can see the effect by resizing the window size of your browser.
Use addMenu()
to add a menu to the navigation bar, e.g. a menu
for contents on the left side of the navigation bar and a right menu for
help. You could also add a search widget with addSearch()
. Note
that if you add several widgets to the right then they are placed from
right to left.
Remark
In some cases, you may want to add a form field to the navigation bar
(e.g. for a compact login option) with addFormField()
.
Top