Home · All Classes · Main Classes · Deprecated
Public Slots | Signals | Public Member Functions | Properties

MContainer Class Reference

A MContainer is a generic container which can be used for any MWidgets. More...

Inherits MWidgetController.

List of all members.

Public Slots

void setHeaderVisible (const bool visibility)
void setProgressIndicatorVisible (bool visibility)
void toggleHeaderVisible ()
void toggleProgressIndicatorVisible ()
void setTitle (const QString &title)
void setIconID (const QString &iconID)
void setText (const QString &text)

Signals

void headerClicked ()

Public Member Functions

 MContainer (QGraphicsItem *parent=0)
 MContainer (const QString &title, QGraphicsItem *parent=0)
virtual ~MContainer ()
QGraphicsWidgetcentralWidget ()
void setCentralWidget (QGraphicsWidget *centralWidget, bool destroy=true)
QString title () const
QString text () const
QString iconID () const
bool headerVisible () const
bool isProgressIndicatorVisible () const

Properties

QGraphicsWidget centralWidget
QString title
QString text
QString iconID
bool headerVisible
bool progressIndicatorVisible

Detailed Description

A MContainer is a generic container which can be used for any MWidgets.

Overview

Containers are used in settings views as well as building blocks for native and WRT (web run time) applets in Experience Canvases.

Example:

 MContainer *box = new MContainer();

 box->setTitle("Header");
 box->setText("More...");
 box->setIconID("My-Icon-ID");

 // Create a button ...
 MButton *button = new MButton("Hello container");

 // and set it as the centralWidget
 box->setCentralWidget(button);

 // clicking the button hides the header
 QObject::connect(button, SIGNAL(clicked()), box, SLOT(toggleHeaderVisible()));

Usage guidelines

Containers can be used for building applets or in application views. They may contain a layout of multiple widgets. Container consist of the content placement box and an optional header, which contains the label and an optional additional label. The header row can be tappable or non-tappable. Containers for web-runtime (WRT) applets don't have a header. If the header row is tappable, the label might be used. It is also recommended to show the number of all items in the additional label. Containers and Applets keep their functionality independent of the device orientation.

For special cases there is an option to have "number of new items / number of all items" in the additional label.

mcontainer.png

The content placement box is the area where the content is drawn by the native / WRT applet. In case the container is not used for an applet, other UI Controls are drawn in the area. The header is as wide as its container. The user can decide if the container has a sub view, in which case it will be themed differently. Titles can be either text, an icon or both of them. This is set by the application or the applet, as well as their values. If not, the title is empty. If the title is too long it will be truncated. The application/applet also defines the usage of the additional label and its content. If it doesn't specify it, it will be empty. The additional label truncates.

See also:
MContainerModel, MContainerView,
Developing applets

Constructor & Destructor Documentation

MContainer::MContainer ( QGraphicsItem parent = 0  ) 

Constructs a container with no title and a parent.

MContainer::MContainer ( const QString title,
QGraphicsItem parent = 0 
)

Constructs a container with the title title and parent parent.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

MContainer::~MContainer (  )  [virtual]

Destroys the container.


Member Function Documentation

QGraphicsWidget* MContainer::centralWidget (  ) 

Returns the widget which is the 'container area'.

void MContainer::headerClicked (  )  [signal]

Signal for informing that the header of the container was clicked.

bool MContainer::headerVisible (  )  const

Returns the logical ID of the icon.

QString MContainer::iconID (  )  const

Returns the logical ID of the icon.

bool MContainer::isProgressIndicatorVisible (  )  const

Returns if the progress indicator is shown.

void MContainer::setCentralWidget ( QGraphicsWidget centralWidget,
bool  destroy = true 
)

Sets the central widget for container. By default MContainer takes ownership of the centralWidget.

If destroy is false, the old centralWidget is removed from the scene and its ownership passed back to caller. If destroy is true (default value), the old central widget is deleted.

void MContainer::setHeaderVisible ( const bool  visibility  )  [slot]

Sets the header visibility.

Parameters:
visibility new visibility state for header
void MContainer::setIconID ( const QString iconID  )  [slot]

Sets the logical ID of the icon.

Parameters:
iconID New icon for the container
void MContainer::setProgressIndicatorVisible ( bool  visibility  )  [slot]

Sets the progress indicator visibility.

Parameters:
visibility new visibility state for progressindicator true for visible, false for hidden
void MContainer::setText ( const QString text  )  [slot]

Set the text of container.

Parameters:
text New text for the container
void MContainer::setTitle ( const QString title  )  [slot]

Set the title of container.

Parameters:
title New title for the container
QString MContainer::text (  )  const

Returns the text of the container.

QString MContainer::title (  )  const

Returns the title of the container.

void MContainer::toggleHeaderVisible (  )  [slot]

Toggle the header visibility.

void MContainer::toggleProgressIndicatorVisible (  )  [slot]

Toggles the progress indicator visibility.


Property Documentation

QGraphicsWidget * MContainer::centralWidget [read, write]

Current widget in the container.

bool MContainer::headerVisible [read, write]

Header visible or not.

QString MContainer::iconID [read, write]

Icon in the header.

bool MContainer::progressIndicatorVisible [read, write]

Progress indicator visible or not.

QString MContainer::text [read, write]

Text in the header.

QString MContainer::title [read, write]

Title of the container.


Copyright © 2010 Nokia Corporation
MeeGo Touch