CMS 3D CMS Logo

AdvListViewItem Class Reference

The AdvListViewItem class implements advanced list view item to be used with AdvListView. More...

#include <Iguana/Studio/interface/AdvListViewItem.h>

List of all members.

Public Member Functions

 AdvListViewItem (QListViewItem *parent, QListViewItem *after, QString, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null)
 AdvListViewItem (QListView *parent, QListViewItem *after, QString, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null)
 AdvListViewItem (QListViewItem *parent, QString, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null)
 AdvListViewItem (QListView *parent, QString, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null, QString=QString::null)
 AdvListViewItem (QListViewItem *parent, QListViewItem *after)
 AdvListViewItem (QListView *parent, QListViewItem *after)
 Creates the branch item and places it after "after" item.
 AdvListViewItem (QListViewItem *parent)
 Creates the branch item with the parent "parent".
 AdvListViewItem (QListView *parent)
 Creates the top level item in the list "parent".
bool isBold ()
 Returns true if this item is bold faced.
bool isCheckable ()
 Returns true if this item can be checked.
bool isChecked ()
 Returns true if this item is checked.
bool isItalic ()
 Returns true if this item is italic.
bool isMagic ()
 Returns true if this item can`t be opened using mouse dblclick on the item`s text.
virtual void paintCell (QPainter *, const QColorGroup &cg, int column, int width, int alignment)
 Reimplemented from QListViewItem.
void setBold (bool is_bold=true)
 Sets the item`s font to be bold faced.
void setCheckable (bool is_checkable=true)
 Sets item to be checkable.
void setChecked (bool is_checked=true)
 Sets item to be checked.
void setItalic (bool is_italic=true)
 Sets the item`s font to be italic.
void setMagic (bool is_magic=true)
 Disables item opening using mouse dblclick.
virtual int width (const QFontMetrics &fm, const QListView *lv, int c) const
 Returns the text width of the item in given column.

Private Member Functions

void init ()
 Initiates the item.

Private Attributes

bool isBold_
bool isCheckable_
bool isChecked_
bool isItalic_
bool isMagic_


Detailed Description

The AdvListViewItem class implements advanced list view item to be used with AdvListView.

It is is a multi-column object capable of displaying itself. Its design has the following main goals:

  1. Work like QListViewItem.
  2. Privide an extra drawing capability.
  3. Allow item checking.
  4. Easy application in simple case.

AdvListView.gif

The simplest way to use AdvListViewItem is to construct one with a few constant strings. This creates an item which is a child of parent with two fixed-content strings, and discards the pointer to it:

(void) new AdvListViewItem( parent, "first column", "second column" );

This object will be deleted when parent is deleted, as for QObjects.

The parent is either another AdvListViewItem or AdvListView. If the parent is an AdvListView, this item is a top-level item within that AdvListView. If the parent is another AdvListViewItem, this item becomes a child of the parent item.

If you keep the pointer, you can set or change the texts using setText(), add pixmaps using setPixmap(), change its mode using setSelectable(), setSelected(), setOpen() and setExpandable(), change its height using setHeight(), and do much tree traversal. The set* functions in AdvListView also affect AdvListViewItem, of course.

Other functions derived from QListViewItem are described in QListViewItem documentation.

Definition at line 54 of file AdvListViewItem.h.


Constructor & Destructor Documentation

AdvListViewItem::AdvListViewItem ( QListView *  parent  ) 

Creates the top level item in the list "parent".

Definition at line 14 of file AdvListViewItem.cc.

References init().

00015     :QListViewItem(parent)
00016 {
00017     init();    
00018 }

AdvListViewItem::AdvListViewItem ( QListViewItem *  parent  ) 

Creates the branch item with the parent "parent".

Creates a new list view item which is a child of parent and first in the parent's list of children.

Definition at line 23 of file AdvListViewItem.cc.

References init().

00024     :QListViewItem(parent)
00025 {
00026     init();    
00027 }

AdvListViewItem::AdvListViewItem ( QListView *  parent,
QListViewItem *  after 
)

Creates the branch item and places it after "after" item.

Constructs an empty list view item which is a child of parent and is after after in the parent's list of children

Definition at line 32 of file AdvListViewItem.cc.

References init().

00033     :QListViewItem(parent, after)
00034 {
00035     init();    
00036 }

AdvListViewItem::AdvListViewItem ( QListViewItem *  parent,
QListViewItem *  after 
)

Constructs an empty list view item which is a child of parent and is after after in the parent's list of children

Definition at line 41 of file AdvListViewItem.cc.

References init().

00042     :QListViewItem(parent, after)
00043 {
00044     init();    
00045 }

AdvListViewItem::AdvListViewItem ( QListView *  parent,
QString  label1,
QString  label2 = QString::null,
QString  label3 = QString::null,
QString  label4 = QString::null,
QString  label5 = QString::null,
QString  label6 = QString::null,
QString  label7 = QString::null,
QString  label8 = QString::null 
)

Creates a new list view item in the QListView parent, parent, with at most 8 constant strings as contents. (void)new QListViewItem( lv, "/", "Root directory" );

See also:
setText()

Definition at line 53 of file AdvListViewItem.cc.

References init().

00062     :QListViewItem(parent, label1, label2, label3, label4, 
00063                    label5, label6, label7, label8)
00064 {
00065     init();    
00066 }

AdvListViewItem::AdvListViewItem ( QListViewItem *  parent,
QString  label1,
QString  label2 = QString::null,
QString  label3 = QString::null,
QString  label4 = QString::null,
QString  label5 = QString::null,
QString  label6 = QString::null,
QString  label7 = QString::null,
QString  label8 = QString::null 
)

Creates a new list view item that's a child of the QListViewItem parent, with at most 8 constant strings as contents. Possible example in a threaded news or e-mail reader:

(void)new QListViewItem( parentMessage, author, subject );

See also:
setText()

Definition at line 77 of file AdvListViewItem.cc.

References init().

00086     :QListViewItem(parent, label1, label2, label3, label4,
00087                    label5, label6, label7, label8)
00088 {
00089     init();    
00090 }

AdvListViewItem::AdvListViewItem ( QListView *  parent,
QListViewItem *  after,
QString  label1,
QString  label2 = QString::null,
QString  label3 = QString::null,
QString  label4 = QString::null,
QString  label5 = QString::null,
QString  label6 = QString::null,
QString  label7 = QString::null,
QString  label8 = QString::null 
)

Creates a new list view item in the QListView parent, after item after, with at most 8 constant strings as contents.

Note that the order is changed according to QListViewItem::key() unless the list view's sorting is disabled using QListView::setSorting( -1 ).

See also:
setText()

Definition at line 102 of file AdvListViewItem.cc.

References init().

00111     :QListViewItem(parent, after, label1, label2, label3, label4, 
00112                    label5, label6, label7, label8)
00113 {
00114     init();    
00115 }

AdvListViewItem::AdvListViewItem ( QListViewItem *  parent,
QListViewItem *  after,
QString  label1,
QString  label2 = QString::null,
QString  label3 = QString::null,
QString  label4 = QString::null,
QString  label5 = QString::null,
QString  label6 = QString::null,
QString  label7 = QString::null,
QString  label8 = QString::null 
)

Creates a new list view item that's a child of the QListViewItem parent, after item after, with at most 8 constant strings as contents.

Note that the order is changed according to QListViewItem::key() unless the list view's sorting is disabled using QListView::setSorting( -1 ).

See also:
setText()

Definition at line 129 of file AdvListViewItem.cc.

References init().

00138     :QListViewItem(parent, after, label1, label2, label3, label4,
00139                    label5, label6, label7, label8)
00140 {
00141     init();    
00142 }


Member Function Documentation

void AdvListViewItem::init ( void   )  [private]

Initiates the item.

Definition at line 144 of file AdvListViewItem.cc.

References isBold_, isCheckable_, isItalic_, and isMagic_.

Referenced by AdvListViewItem().

00145 {
00146     isBold_ = isItalic_ = isMagic_ = isCheckable_ = false;
00147 }

bool AdvListViewItem::isBold (  )  [inline]

Returns true if this item is bold faced.

Definition at line 91 of file AdvListViewItem.h.

00091 { return isBold_;   }

bool AdvListViewItem::isCheckable (  )  [inline]

Returns true if this item can be checked.

Definition at line 98 of file AdvListViewItem.h.

Referenced by AdvListView::initItem(), and AdvListView::setChecked().

00098 {return isCheckable_; }

bool AdvListViewItem::isChecked (  )  [inline]

Returns true if this item is checked.

Definition at line 100 of file AdvListViewItem.h.

Referenced by AdvListView::initItem(), and AdvListView::setChecked().

00100 {return isChecked_; }

bool AdvListViewItem::isItalic (  )  [inline]

Returns true if this item is italic.

Definition at line 93 of file AdvListViewItem.h.

00093 { return isItalic_; }

bool AdvListViewItem::isMagic (  )  [inline]

Returns true if this item can`t be opened using mouse dblclick on the item`s text.

Definition at line 96 of file AdvListViewItem.h.

00096 { return isMagic_;  }

void AdvListViewItem::paintCell ( QPainter *  p,
const QColorGroup &  cg,
int  column,
int  width,
int  alignment 
) [virtual]

Reimplemented from QListViewItem.

Definition at line 149 of file AdvListViewItem.cc.

References isBold_, and isItalic_.

00151 {
00152     QFont old_font( p->font());
00153     
00154     QFont new_font( p->font());
00155     new_font.setBold(isBold_);
00156     new_font.setItalic(isItalic_);   
00157     
00158     p->setFont(new_font);
00159     QListViewItem::paintCell(p, cg, column, width, align);
00160     p->setFont(old_font);
00161 }

void AdvListViewItem::setBold ( bool  is_bold = true  )  [inline]

Sets the item`s font to be bold faced.

Definition at line 103 of file AdvListViewItem.h.

00103 { isBold_   = is_bold;   }

void AdvListViewItem::setCheckable ( bool  is_checkable = true  )  [inline]

Sets item to be checkable.

Definition at line 109 of file AdvListViewItem.h.

00109 { isCheckable_ = is_checkable; }

void AdvListViewItem::setChecked ( bool  is_checked = true  ) 

Sets item to be checked.

Definition at line 174 of file AdvListViewItem.cc.

References isChecked_, list(), and AdvListView::setChecked().

Referenced by AdvListView::setChecked().

00175 { 
00176     isChecked_ = is_checked; 
00177     AdvListView* list = static_cast<AdvListView*>(listView());
00178     if (list) 
00179         list->setChecked(this, is_checked);
00180 }

void AdvListViewItem::setItalic ( bool  is_italic = true  )  [inline]

Sets the item`s font to be italic.

Definition at line 105 of file AdvListViewItem.h.

00105 { isItalic_ = is_italic; }

void AdvListViewItem::setMagic ( bool  is_magic = true  )  [inline]

Disables item opening using mouse dblclick.

Definition at line 107 of file AdvListViewItem.h.

00107 { isMagic_  = is_magic;  }

int AdvListViewItem::width ( const QFontMetrics &  fm,
const QListView *  lv,
int  c 
) const [virtual]

Returns the text width of the item in given column.

Definition at line 163 of file AdvListViewItem.cc.

References isBold_, isItalic_, and width.

00165 {  
00166     QFont new_font(listView()->font());
00167     new_font.setBold(isBold_);
00168     new_font.setItalic(isItalic_);   
00169     QFontMetrics fm_new(new_font);
00170   
00171     return QListViewItem::width(fm_new, lv, c);
00172 }


Member Data Documentation

bool AdvListViewItem::isBold_ [private]

Definition at line 116 of file AdvListViewItem.h.

Referenced by init(), paintCell(), and width().

bool AdvListViewItem::isCheckable_ [private]

Definition at line 119 of file AdvListViewItem.h.

Referenced by init().

bool AdvListViewItem::isChecked_ [private]

Definition at line 120 of file AdvListViewItem.h.

Referenced by setChecked().

bool AdvListViewItem::isItalic_ [private]

Definition at line 117 of file AdvListViewItem.h.

Referenced by init(), paintCell(), and width().

bool AdvListViewItem::isMagic_ [private]

Definition at line 118 of file AdvListViewItem.h.

Referenced by init().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:13:53 2009 for CMSSW by  doxygen 1.5.4