OpenMW
Public Types | Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Private Attributes
CSVWorld::DataDisplayDelegate Class Reference

#include <datadisplaydelegate.hpp>

List of all members.

Public Types

typedef std::vector< std::pair
< int, QIcon > > 
IconList
typedef std::vector< std::pair
< int, QString > > 
ValueList

Public Member Functions

 DataDisplayDelegate (const ValueList &values, const IconList &icons, QUndoStack &undoStack, QObject *parent)
 ~DataDisplayDelegate ()
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
void setIconSize (const QSize icon)
 pass a QSize defining height / width of icon. Default is QSize (16,16).
void setIconLeftOffset (int offset)
 offset the horizontal position of the icon from the left edge of the cell. Default is 3 pixels.
void setTextLeftOffset (int offset)
 offset the horizontal position of the text from the right edge of the icon. Default is 8 pixels.

Protected Types

enum  DisplayMode { Mode_TextOnly, Mode_IconOnly, Mode_IconAndText }

Protected Attributes

DisplayMode mDisplayMode
IconList mIcons

Private Member Functions

void paintIcon (QPainter *painter, const QStyleOptionViewItem &option, int i) const
 custom paint function for painting the icon. Mode_IconAndText and Mode_Icon only.
void buildPixmaps ()
 rebuild the list of pixmaps from the provided icons (called when icon size is changed)

Private Attributes

std::vector< std::pair< int,
QPixmap > > 
mPixmaps
QTextOption mTextAlignment
QSize mIconSize
int mIconLeftOffset
int mTextLeftOffset

Member Typedef Documentation

typedef std::vector< std::pair < int, QIcon > > CSVWorld::DataDisplayDelegate::IconList
typedef std::vector<std::pair<int, QString> > CSVWorld::DataDisplayDelegate::ValueList

Member Enumeration Documentation

Enumerator:
Mode_TextOnly 
Mode_IconOnly 
Mode_IconAndText 

Constructor & Destructor Documentation

CSVWorld::DataDisplayDelegate::DataDisplayDelegate ( const ValueList values,
const IconList icons,
QUndoStack &  undoStack,
QObject *  parent 
) [explicit]

Member Function Documentation

rebuild the list of pixmaps from the provided icons (called when icon size is changed)

void CSVWorld::DataDisplayDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [virtual]

Reimplemented from CSVWorld::EnumDelegate.

void CSVWorld::DataDisplayDelegate::paintIcon ( QPainter *  painter,
const QStyleOptionViewItem &  option,
int  i 
) const [private]

custom paint function for painting the icon. Mode_IconAndText and Mode_Icon only.

offset the horizontal position of the icon from the left edge of the cell. Default is 3 pixels.

void CSVWorld::DataDisplayDelegate::setIconSize ( const QSize  icon)

pass a QSize defining height / width of icon. Default is QSize (16,16).

offset the horizontal position of the text from the right edge of the icon. Default is 8 pixels.


Member Data Documentation

std::vector<std::pair <int, QPixmap> > CSVWorld::DataDisplayDelegate::mPixmaps [private]

The documentation for this class was generated from the following files: