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...

Inheritance diagram for MToolBar:
Inheritance graph
[legend]
Collaboration diagram for MToolBar:
Collaboration graph
[legend]

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

Definition at line 116 of file corelib/widgets/mtoolbar.h.


Constructor & Destructor Documentation

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

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

Definition at line 55 of file mtoolbar.cpp.

    : MWidgetController(new MToolBarPrivate(), new MWidgetModel(), parent)
{
    Q_D(MToolBar);
    d->initLayout();
    Q_UNUSED(viewType);
}

MToolBar::~MToolBar (  )  [virtual]

Destructs the toolbar object.

Definition at line 70 of file mtoolbar.cpp.

{
}

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

Definition at line 63 of file mtoolbar.cpp.

    : MWidgetController(dd, model, parent)
{
    Q_D(MToolBar);
    d->initLayout();
}


Member Data Documentation

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

Variable that defines id for tab variant of the toolbar.

Definition at line 124 of file corelib/widgets/mtoolbar.h.


Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:14:27 (PDT)
Doxygen 1.7.1
MeeGo Touch