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

Inherits MWidgetController.

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

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 

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 

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.
MContentItem::~MContentItem (  )  [virtual]

Destructor.


Member Function Documentation

MWidget * MContentItem::additionalItem (  )  const

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

void MContentItem::click (  )  [slot]

Makes content item to send clicked() signal.

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.

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

Handler of notifications of receivers disconnecting from MContentItem signals.

void MContentItem::enableProgressBar (  )  [slot]

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

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. You might also be interested in using cancel event with that gesture, please see also MWidget::grabGestureWithCancelPolicy() method.

See also:
MWidget::grabGestureWithCancelPolicy.
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.
void MContentItem::setImage ( const QImage pixmap  )  [slot]

Sets thumbnail image.

Parameters:
pixmap Image
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.

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

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

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

Sets an optional image (Icon).

Parameters:
image QImage
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.

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

Sets an optional pixmap (Icon).

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

Sets thumbnail pixmap.

Parameters:
pixmap QPixmap
void MContentItem::setSmallItem ( MWidget widget  )  [slot]

Sets a MWidget as a widget below the right icon.

Parameters:
widget MWidget
void MContentItem::setSmallText ( QString  text  )  [slot]

Convenience method for setting a text below the right icon.

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

Set subtitle text.

This is second line.

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

Set title text.

This is first line.

Parameters:
text text.
MWidget * MContentItem::smallItem (  )  const

Returns a pointer to the small widget.

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]
MContentItem::imageID [read, write]

image from theme which will be displayed

MContentItem::itemMode [read, write]

specifies item mode

MContentItem::itemStyle [read]

specifies item style

MContentItem::optionalImage [read, write]

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

QString MContentItem::optionalImageID [read, write]
QPixmap MContentItem::optionalPixmap [read, write]
MContentItem::pixmap [read, write]

pixmap which will be displayed

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

Copyright © 2010 Nokia Corporation
MeeGo Touch