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

MContentItem Class Reference

MContentItem is a widget for displaying thumbnail and 2 lines of text. Can be used as a standalone widget in a layout or in MList as list item. More...

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

List of all members.

Public Types

enum  ContentItemStyle {
  IconAndTwoTextLabels = 0, SingleTextLabel, IconAndSingleTextLabel, TwoTextLabels,
  SingleIcon, IconAndSingleTextLabelVertical, IconAndTwoTextLabelsVertical, TwoIconsTwoWidgets
}
enum  ContentItemMode {
  Default = 0, TopLeft, Top, TopRight,
  Left, Center, Right, Single,
  BottomLeft, Bottom, BottomRight, SingleRowLeft,
  SingleRowCenter, SingleRowRight, SingleColumnTop, SingleColumnCenter,
  SingleColumnBottom, TwoIconsTextLabelVertical
}

Public Slots

void setPixmap (const QPixmap &pixmap)
void setImage (const QImage &pixmap)
void setImageID (const QString &id, const QSize &size=QSize())
void setTitle (const QString &text)
void setSubtitle (const QString &text)
void setItemMode (ContentItemMode mode)
void setAdditionalItem (MWidget *widget)
void enableProgressBar ()
void setSmallItem (MWidget *widget)
void setSmallText (QString text)
void setOptionalPixmap (const QPixmap &pixmap)
void setOptionalImage (const QImage &image)
void setOptionalImageID (const QString &id, const QSize &s=QSize())
void click ()
void longTap (const QPointF &pos)

Signals

void clicked ()
void longTapped (const QPointF &pos)

Public Member Functions

 MContentItem (MContentItem::ContentItemStyle itemStyle=MContentItem::IconAndTwoTextLabels, QGraphicsItem *parent=0)
virtual ~MContentItem ()
QPixmap pixmap () const
QImage image () const
QString imageID () const
QString title () const
QString subtitle () const
MContentItem::ContentItemMode itemMode () const
MContentItem::ContentItemStyle itemStyle () const
MWidgetadditionalItem () const
MWidgetsmallItem () const
QPixmap optionalPixmap () const
QImage optionalImage () const
QString optionalImageID () const

Protected Member Functions

virtual void connectNotify (const char *signal)
virtual void disconnectNotify (const char *signal)

Properties

ContentItemStyle itemStyle
ContentItemMode itemMode
QPixmap pixmap
QImage image
QString imageID
QString title
QString subtitle
QPixmap optionalPixmap
QImage optionalImage
QString optionalImageID

Detailed Description

MContentItem is a widget for displaying thumbnail and 2 lines of text. Can be used as a standalone widget in a layout or in MList as list item.

Overview

MContentItem provides functionality which is similar to button. It can show 2 lines of text and an icon (thumbnail). Tapping on widget will trigger clicked() signal. Widget can be selected via setSelected() and selection status can be queried via isSelected() function.

MContentItem provides the following styles:

MContentItem can be in one of the modes provided by ContentItemMode enumeration. For each mode there is a dedicated graphics which is up to the view to show. The purpose of mode is to indicate logical position of item so that correct background can be used. For more details take a look at MContentItemView.

See also:
MContentItemView

Definition at line 57 of file corelib/widgets/mcontentitem.h.


Member Enumeration Documentation

ContentItemMode indicates logical position of content item relative other items. Exact look and feel depends on the view.

See also:
MContentItemView
Enumerator:
Default 
TopLeft 
Top 
TopRight 
Left 
Center 
Right 
Single 
BottomLeft 
Bottom 
BottomRight 
SingleRowLeft 
SingleRowCenter 
SingleRowRight 
SingleColumnTop 
SingleColumnCenter 
SingleColumnBottom 
TwoIconsTextLabelVertical 

Definition at line 87 of file corelib/widgets/mcontentitem.h.

                         {
        Default = 0,
        TopLeft,
        Top,
        TopRight,
        Left,
        Center,
        Right,
        Single,
        BottomLeft,
        Bottom,
        BottomRight,
        SingleRowLeft,
        SingleRowCenter,
        SingleRowRight,
        SingleColumnTop,
        SingleColumnCenter,
        SingleColumnBottom,
        TwoIconsTextLabelVertical
    };

ContentItemStyle indicates how text and thumbnail should be shown. There are 8 predefined layouts. Exact look and feel depends on the view.

See also:
MContentItemView
Enumerator:
IconAndTwoTextLabels 
SingleTextLabel 
IconAndSingleTextLabel 
TwoTextLabels 
SingleIcon 
IconAndSingleTextLabelVertical 
IconAndTwoTextLabelsVertical 
TwoIconsTwoWidgets 

Definition at line 69 of file corelib/widgets/mcontentitem.h.

    {
         IconAndTwoTextLabels = 0,
         SingleTextLabel,
         IconAndSingleTextLabel,
         TwoTextLabels,
         SingleIcon,
         IconAndSingleTextLabelVertical,
         IconAndTwoTextLabelsVertical,
         TwoIconsTwoWidgets
     };


Constructor & Destructor Documentation

MContentItem::MContentItem ( MContentItem::ContentItemStyle  itemStyle = MContentItem::IconAndTwoTextLabels,
QGraphicsItem parent = 0 
)

Constructs a MContentItem with a specific style and a parent.

Parameters:
itemStyle specifies style of content item
parent Parent object.

Definition at line 54 of file corelib/widgets/mcontentitem.cpp.

    : MWidgetController(new MContentItemPrivate, new MContentItemModel, parent)
{
    model()->setItemStyle(itemStyle);
}

Here is the call graph for this function:

MContentItem::~MContentItem (  )  [virtual]

Destructor.

Definition at line 65 of file corelib/widgets/mcontentitem.cpp.

{

}


Member Function Documentation

MWidget * MContentItem::additionalItem (  )  const

Returns the logical ID of the contentItem's additional image.

Definition at line 212 of file corelib/widgets/mcontentitem.cpp.

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

Here is the call graph for this function:

void MContentItem::click (  )  [slot]

Makes content item to send clicked() signal.

Definition at line 149 of file corelib/widgets/mcontentitem.cpp.

{
    emit clicked();
}

Here is the call graph for this function:

void MContentItem::clicked (  )  [signal]

This signal is emitted when content item is pressed.

void MContentItem::connectNotify ( const char *  signal  )  [protected, virtual]

Handler of notifications of new receivers connected to MContentItem signals.

Definition at line 258 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);

    if (QLatin1String(signal) == SIGNAL(longTapped(QPointF))) {
        d->updateLongTapConnections();
    }
}

Here is the call graph for this function:

void MContentItem::disconnectNotify ( const char *  signal  )  [protected, virtual]

Handler of notifications of receivers disconnecting from MContentItem signals.

Definition at line 267 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);

    if (QLatin1String(signal) == SIGNAL(longTapped(QPointF))) {
        d->updateLongTapConnections();
    }
}

Here is the call graph for this function:

void MContentItem::enableProgressBar (  )  [slot]

Convenience method which sets a progress bar as the additional item.

Definition at line 217 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);
    if(d->progressIndicator == NULL)
    {
        d->progressIndicator = new MProgressIndicator(this);
        d->progressIndicator->setViewType(MProgressIndicator::barType);
        d->progressIndicator->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Expanding);
        model()->setAdditionalItem(d->progressIndicator);
    }
}

Here is the call graph for this function:

QImage MContentItem::image (  )  const

Get the thumbnail image.

Returns:
thumbnail image
QString MContentItem::imageID (  )  const

Returns the logical ID of the contentItem's image.

MContentItem::ContentItemMode MContentItem::itemMode (  )  const

Returns item's mode.

MContentItem::ContentItemStyle MContentItem::itemStyle (  )  const

Returns item's style.

void MContentItem::longTap ( const QPointF pos  )  [slot]

Makes the content item to send longTapped signal.

Parameters:
pos The position of the tap.

If the MContentItem is used outside MList, the user needs to invoke item->grabGesture(Qt::TapAndHoldGesture) to start receiving longTapped() signal.

Definition at line 154 of file corelib/widgets/mcontentitem.cpp.

{
    emit longTapped(pos);
}

Here is the call graph for this function:

void MContentItem::longTapped ( const QPointF pos  )  [signal]

The signal is emitted when the content item has been tapped and holded.

QImage MContentItem::optionalImage (  )  const

Returns optional image (Icon)

QString MContentItem::optionalImageID (  )  const

Returns the logical ID of the contentItem's optional image.

QPixmap MContentItem::optionalPixmap (  )  const

Returns optional pixmap (Icon)

QPixmap MContentItem::pixmap (  )  const

Get the thumbnail pixmap.

Returns:
thumbnail pixmap
void MContentItem::setAdditionalItem ( MWidget widget  )  [slot]

Sets a MWidget as e.g. progress bar, below the title.

Parameters:
widget MWidget In case there is already a subtitle it will be replaced.

Definition at line 207 of file corelib/widgets/mcontentitem.cpp.

{
    model()->setAdditionalItem(widget);
}

Here is the call graph for this function:

void MContentItem::setImage ( const QImage pixmap  )  [slot]

Sets thumbnail image.

Parameters:
pixmap Image

Definition at line 114 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);
    d->image = image;
    model()->setItemImage(d->image);
}

Here is the call graph for this function:

void MContentItem::setImageID ( const QString id,
const QSize size = QSize() 
) [slot]

Sets the logical ID of the contentItem image to id.

If size is not specified, whatever size the graphics happens to be in the theme will be used.

Definition at line 121 of file corelib/widgets/mcontentitem.cpp.

{
    model()->beginTransaction();
    model()->setItemImageID(id);
    model()->setItemImageSize(size);
    model()->commitTransaction();
}

Here is the call graph for this function:

void MContentItem::setItemMode ( ContentItemMode  mode  )  [slot]

Sets item's mode. Mode defines how item's background should look. Exact look is defined in style.

Definition at line 144 of file corelib/widgets/mcontentitem.cpp.

{
    model()->setItemMode(mode);
}

Here is the call graph for this function:

void MContentItem::setOptionalImage ( const QImage image  )  [slot]

Sets an optional image (Icon).

Parameters:
image QImage

Definition at line 175 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);
    d->optionalImage = image;
    model()->setOptionalImage(d->optionalImage);
}

Here is the call graph for this function:

void MContentItem::setOptionalImageID ( const QString id,
const QSize s = QSize() 
) [slot]

Sets the logical ID of the contentItem's optional image to id.

If size is not specified, whatever size the graphics happens to be in the theme will be used.

Definition at line 182 of file corelib/widgets/mcontentitem.cpp.

{
    model()->beginTransaction();
    model()->setOptionalImageID(id);
    model()->setOptionalImageSize(size);
    model()->commitTransaction();
}

Here is the call graph for this function:

void MContentItem::setOptionalPixmap ( const QPixmap pixmap  )  [slot]

Sets an optional pixmap (Icon).

Parameters:
pixmap QPixmap

Definition at line 168 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);
    d->optionalPixmap = pixmap;
    model()->setOptionalPixmap(d->optionalPixmap);
}

Here is the call graph for this function:

void MContentItem::setPixmap ( const QPixmap pixmap  )  [slot]

Sets thumbnail pixmap.

Parameters:
pixmap QPixmap

Definition at line 107 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);
    d->pixmap = pixmap;
    model()->setItemPixmap(d->pixmap);
}

Here is the call graph for this function:

void MContentItem::setSmallItem ( MWidget widget  )  [slot]

Sets a MWidget as a widget below the right icon.

Parameters:
widget MWidget

Definition at line 229 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);

    if (d->smallText) {
        delete d->smallText;
        d->smallText = 0;
    }
    model()->setSmallItem(widget);
}

Here is the call graph for this function:

void MContentItem::setSmallText ( QString  text  )  [slot]

Convenience method for setting a text below the right icon.

Definition at line 245 of file corelib/widgets/mcontentitem.cpp.

{
    Q_D(MContentItem);

    if (d->smallText) {
        d->smallText->setText(text);
    } else {
        d->smallText = new MLabel(text);
        d->smallText->setAlignment( Qt::AlignRight );
        model()->setSmallItem(d->smallText);
    }
}

Here is the call graph for this function:

void MContentItem::setSubtitle ( const QString text  )  [slot]

Set subtitle text.

This is second line.

Parameters:
text text.

Definition at line 134 of file corelib/widgets/mcontentitem.cpp.

{
    if (additionalItem()) {
        additionalItem()->setVisible(false);
        setAdditionalItem(0);
    }

    model()->setSubtitle(text);
}

Here is the call graph for this function:

void MContentItem::setTitle ( const QString text  )  [slot]

Set title text.

This is first line.

Parameters:
text text.

Definition at line 129 of file corelib/widgets/mcontentitem.cpp.

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

Here is the call graph for this function:

MWidget * MContentItem::smallItem (  )  const

Returns a pointer to the small widget.

Definition at line 240 of file corelib/widgets/mcontentitem.cpp.

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

Here is the call graph for this function:

QString MContentItem::subtitle (  )  const

Get the subtitle.

Returns:
subtitle text string.
QString MContentItem::title (  )  const

Get the title.

Returns:
title text string.

Property Documentation

QImage MContentItem::image [read, write]

Definition at line 126 of file corelib/widgets/mcontentitem.h.

MContentItem::imageID [read, write]

image from theme which will be displayed

Definition at line 132 of file corelib/widgets/mcontentitem.h.

MContentItem::itemMode [read, write]

specifies item mode

Definition at line 118 of file corelib/widgets/mcontentitem.h.

MContentItem::itemStyle [read]

specifies item style

Definition at line 112 of file corelib/widgets/mcontentitem.h.

MContentItem::optionalImage [read, write]

image from theme which will be displayed as "optional image"

Definition at line 152 of file corelib/widgets/mcontentitem.h.

QString MContentItem::optionalImageID [read, write]

Definition at line 158 of file corelib/widgets/mcontentitem.h.

QPixmap MContentItem::optionalPixmap [read, write]

Definition at line 150 of file corelib/widgets/mcontentitem.h.

MContentItem::pixmap [read, write]

pixmap which will be displayed

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

MContentItem::subtitle [read, write]
MContentItem::title [read, write]

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