Base class for list items. More...
#include <listitem.h>
Public Types | |
enum | TextSize { TEXT_SIZE_NORMAL, TEXT_SIZE_SMALL } |
Defines text size. | |
Public Member Functions | |
ListItem () | |
Constructor. | |
void | setImage (const QPixmap &image) |
Sets item's image. | |
void | setTitle (const QString &name) |
Sets item's title. | |
virtual void | setSelected (bool selected)=0 |
Sets item selected. | |
void | setSize (const QSize &size) |
Sets item size. | |
QString | shortenText (const QString &text, int textWidth, TextSize textSize) |
Shortens text defined by text width. | |
QString | title () const |
Returns item's title. | |
virtual bool | toggleSelection ()=0 |
Toggles selection. | |
Private Attributes | |
QPixmap | m_image |
Item's image. | |
QString | m_name |
Item's name. |
Base class for list items.
Stores item's name and image and includes method to shorten texts.
void ListItem::setImage | ( | const QPixmap & | image | ) |
Sets item's image.
image | QPixmap |
virtual void ListItem::setSelected | ( | bool | selected | ) | [pure virtual] |
Sets item selected.
selected | true if selected, false otherwise |
Implemented in ExtendedListItem.
void ListItem::setSize | ( | const QSize & | size | ) |
Sets item size.
size | item size |
void ListItem::setTitle | ( | const QString & | name | ) |
Sets item's title.
name | item's title |
QString ListItem::shortenText | ( | const QString & | text, | |
int | textWidth, | |||
TextSize | textSize | |||
) |
Shortens text defined by text width.
text | text to be shortened | |
textWidth | the width the text can use | |
textSize | which text size to use |
QString ListItem::title | ( | ) | const |
Returns item's title.
virtual bool ListItem::toggleSelection | ( | ) | [pure virtual] |
Toggles selection.
Implemented in ExtendedListItem.