OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CSVWorld::DataDisplayDelegate Class Reference

#include <datadisplaydelegate.hpp>

Inheritance diagram for CSVWorld::DataDisplayDelegate:
Collaboration diagram for CSVWorld::DataDisplayDelegate:

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, CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document &document, const std::string &pageName, const std::string &settingName, QObject *parent)
 
 ~DataDisplayDelegate ()
 
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
 
virtual QSize sizeHint (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). More...
 
void setTextLeftOffset (int offset)
 offset the horizontal position of the text from the right edge of the icon. Default is 8 pixels. More...
 
- Public Member Functions inherited from CSVWorld::EnumDelegate
 EnumDelegate (const std::vector< std::pair< int, QString > > &values, CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document &document, QObject *parent)
 
virtual QWidgetcreateEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
 
virtual QWidgetcreateEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index, CSMWorld::ColumnBase::Display display=CSMWorld::ColumnBase::Display_None) const
 
virtual void setEditorData (QWidget *editor, const QModelIndex &index, bool tryDisplay=false) const
 
- Public Member Functions inherited from CSVWorld::CommandDelegate
 CommandDelegate (CSMWorld::CommandDispatcher *commandDispatcher, CSMDoc::Document &document, QObject *parent)
 
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
 
void setEditLock (bool locked)
 
bool isEditLocked () const
 
virtual void setEditorData (QWidget *editor, const QModelIndex &index) const
 

Protected Types

enum  DisplayMode { Mode_TextOnly, Mode_IconOnly, Mode_IconAndText }
 

Protected Attributes

DisplayMode mDisplayMode
 
IconList mIcons
 
- Protected Attributes inherited from CSVWorld::EnumDelegate
std::vector< std::pair< int,
QString > > 
mValues
 

Private Member Functions

void updateDisplayMode (const std::string &)
 update the display mode based on a passed string More...
 
void paintIcon (QPainter *painter, const QStyleOptionViewItem &option, int i) const
 custom paint function for painting the icon. Mode_IconAndText and Mode_Icon only. More...
 
void buildPixmaps ()
 rebuild the list of pixmaps from the provided icons (called when icon size is changed) More...
 
virtual void settingChanged (const CSMPrefs::Setting *setting)
 

Private Attributes

std::vector< std::pair< int,
QPixmap > > 
mPixmaps
 
QSize mIconSize
 
int mHorizontalMargin
 
int mTextLeftOffset
 
std::string mSettingKey
 

Additional Inherited Members

- Protected Member Functions inherited from CSVWorld::EnumDelegate
int getValueIndex (const QModelIndex &index, int role=Qt::DisplayRole) const
 
- Protected Member Functions inherited from CSVWorld::CommandDelegate
QUndoStack & getUndoStack () const
 
CSMDoc::DocumentgetDocument () const
 
CSMWorld::ColumnBase::Display getDisplayTypeFromIndex (const QModelIndex &index) const
 

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,
CSMWorld::CommandDispatcher dispatcher,
CSMDoc::Document document,
const std::string &  pageName,
const std::string &  settingName,
QObject parent 
)

Here is the call graph for this function:

CSVWorld::DataDisplayDelegate::~DataDisplayDelegate ( )

Member Function Documentation

void CSVWorld::DataDisplayDelegate::buildPixmaps ( )
private

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

Here is the caller graph for this function:

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

Reimplemented from CSVWorld::EnumDelegate.

Here is the call graph for this function:

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.

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

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

void CSVWorld::DataDisplayDelegate::setTextLeftOffset ( int  offset)

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

void CSVWorld::DataDisplayDelegate::settingChanged ( const CSMPrefs::Setting setting)
privatevirtual
Attention
This is not a slot. For ordering reasons this function needs to be called manually from the parent object's settingChanged function.

Reimplemented from CSVWorld::CommandDelegate.

Here is the call graph for this function:

QSize CSVWorld::DataDisplayDelegate::sizeHint ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
virtual

Reimplemented from CSVWorld::EnumDelegate.

Here is the call graph for this function:

void CSVWorld::DataDisplayDelegate::updateDisplayMode ( const std::string &  mode)
private

update the display mode based on a passed string

Here is the caller graph for this function:

Member Data Documentation

DisplayMode CSVWorld::DataDisplayDelegate::mDisplayMode
protected
int CSVWorld::DataDisplayDelegate::mHorizontalMargin
private
IconList CSVWorld::DataDisplayDelegate::mIcons
protected
QSize CSVWorld::DataDisplayDelegate::mIconSize
private
std::vector<std::pair <int, QPixmap> > CSVWorld::DataDisplayDelegate::mPixmaps
private
std::string CSVWorld::DataDisplayDelegate::mSettingKey
private
int CSVWorld::DataDisplayDelegate::mTextLeftOffset
private

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