Home · All Classes · Main Classes · Deprecated
Public Member Functions | Static Public Attributes | Protected Member Functions

MToolBar Class Reference

MToolBar provides a container for buttons and text input field. More...

Inherits MWidgetController.

List of all members.

Public Member Functions

 MToolBar (QGraphicsItem *parent=0, const QString &viewType="")
virtual ~MToolBar ()

Static Public Attributes

static const MTheme::ViewType tabType = "tab"

Protected Member Functions

 MToolBar (MToolBarPrivate *dd, MWidgetModel *model, QGraphicsItem *parent)

Detailed Description

MToolBar provides a container for buttons and text input field.

Overview

Toolbar acts as a container for actions. Depending upon the view attached, it either acts as a tab bar or is a container for buttons and text input field. Tab bar is a container for mutually exclusive latch-down type of buttons. It contains navigational and sorting actions that are relevant to the view but not related to any individual item displayed directly within the content area.

This class is not recommended to be used directly instead action can be added to the toolbar in the page using: action->setLocation(MAction::ToolBarLocation);

Setting up a new toolbar is quite easy. The following example shows how actions are added to a toolbar.

        MToolBar* toolbar = new MToolBar();
        MAction * iconAction = new MAction("icon-l-gallery","Pictures", this);
        iconAction->setLocation(MAction::ToolBarLocation);
        toolbar->addAction(iconAction);
        MTextEdit *entry = new MTextEdit();
        entry->setViewType("toolbar");
        MWidgetAction *action = new MWidgetAction(this);
        action->setLocation(MAction::ToolBarLocation);
        action->setWidget(entry);
        toolbar->addAction(action);

In case it is desired to add actions to tab bar view, it is necessary to set the view of the the toolbar to be of tab type. Here is how the view of the toolbar can be changed to tab bar.

        toolbar->setViewType(MToolBar::tabType);

Following demonstates how to add a tab action to the toolbar:

        MToolBar* toolbar = new MToolBar();
        MAction *action = new MAction("icon-l-gallery", NULL, this);
        action->setLocation(MAction::ToolbarLocation);
        action->setCheckable(true);
        action->setChecked(true);
        connect(action, SIGNAL(triggered()), this, SLOT(showPicture()));
        addAction(action);

Usage guidelines

Variants

Open issues

See also:
MToolbarStyle

Constructor & Destructor Documentation

MToolBar::MToolBar ( QGraphicsItem parent = 0,
const QString viewType = "" 
)

Constructs a toolbar containing no actions with optional parent and viewType.

MToolBar::~MToolBar (  )  [virtual]

Destructs the toolbar object.

MToolBar::MToolBar ( MToolBarPrivate *  dd,
MWidgetModel model,
QGraphicsItem parent 
) [protected]

protected constructor

Parameters:
dd Shared private class
model The model. This must not be NULL.
parent Parent widget

Member Data Documentation

const MTheme::ViewType MToolBar::tabType = "tab" [static]

Variable that defines id for tab variant of the toolbar.


Copyright © 2010 Nokia Corporation
MeeGo Touch