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

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

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,
Applet development How-To

Definition at line 89 of file corelib/widgets/mcontainer.h.


Constructor & Destructor Documentation

MContainer::MContainer ( QGraphicsItem parent = 0  ) 

Constructs a container with no title and a parent.

Definition at line 48 of file mcontainer.cpp.

    : MWidgetController(new MContainerPrivate(), new MContainerModel(), parent)
{
    Q_D(MContainer);

    d->init();
}

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.

Definition at line 56 of file mcontainer.cpp.

    : MWidgetController(new MContainerPrivate(), new MContainerModel(), parent)
{
    Q_D(MContainer);

    d->init(title);
}

MContainer::~MContainer (  )  [virtual]

Destroys the container.

Definition at line 64 of file mcontainer.cpp.

{
}


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.

Definition at line 133 of file mcontainer.cpp.

{
    return model()->progressIndicatorVisible();
}

Here is the call graph for this function:

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

Sets the central widget for container.

Definition at line 73 of file mcontainer.cpp.

{
    if (centralWidget != NULL) {
        const QGraphicsWidget *oldCentralWidget = model()->centralWidget();

        // Set the new central widget
        model()->setCentralWidget(centralWidget);

        // Destroy the old central widget if requested
        if (destroy) {
            delete oldCentralWidget;
        }
    }
}

Here is the call graph for this function:

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

Sets the header visibility.

Parameters:
visibility new visibility state for header

Definition at line 123 of file mcontainer.cpp.

{
    model()->setHeaderVisible(visibility);
}

Here is the call graph for this function:

void MContainer::setIconID ( const QString iconID  )  [slot]

Sets the logical ID of the icon.

Parameters:
iconID New icon for the container

Definition at line 113 of file mcontainer.cpp.

{
    model()->setIcon(iconID);
}

Here is the call graph for this function:

void MContainer::setProgressIndicatorVisible ( bool  visibility  )  [slot]

Sets the progress indicator visibility.

Parameters:
visibility new visibility state for progressindicator true for visible, false for hidden

Definition at line 138 of file mcontainer.cpp.

{
    model()->setProgressIndicatorVisible(visibility);
}

Here is the call graph for this function:

void MContainer::setText ( const QString text  )  [slot]

Set the text of container.

Parameters:
text New text for the container

Definition at line 103 of file mcontainer.cpp.

{
    model()->setText(text);
}

Here is the call graph for this function:

void MContainer::setTitle ( const QString title  )  [slot]

Set the title of container.

Parameters:
title New title for the container

Definition at line 93 of file mcontainer.cpp.

{
    model()->setTitle(newTitle);
}

Here is the call graph for this function:

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.

Definition at line 128 of file mcontainer.cpp.

Here is the call graph for this function:

void MContainer::toggleProgressIndicatorVisible (  )  [slot]

Toggles the progress indicator visibility.

Definition at line 143 of file mcontainer.cpp.

Here is the call graph for this function:


Property Documentation

QGraphicsWidget * MContainer::centralWidget [read, write]

Current widget in the container.

Definition at line 95 of file corelib/widgets/mcontainer.h.

bool MContainer::headerVisible [read, write]

Header visible or not.

Definition at line 107 of file corelib/widgets/mcontainer.h.

QString MContainer::iconID [read, write]

Icon in the header.

Definition at line 104 of file corelib/widgets/mcontainer.h.

bool MContainer::progressIndicatorVisible [read, write]

Progress indicator visible or not.

Definition at line 110 of file corelib/widgets/mcontainer.h.

QString MContainer::text [read, write]

Text in the header.

Definition at line 101 of file corelib/widgets/mcontainer.h.

QString MContainer::title [read, write]

Title of the container.

Definition at line 98 of file corelib/widgets/mcontainer.h.


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