The Q3ListBoxItem class is the base class of all list box items. 更多...
| 头: | #include <Q3ListBoxItem> |
| 继承者: | Q3ListBoxPixmap and Q3ListBoxText |
| Q3ListBoxItem (Q3ListBox * listbox = 0) | |
| Q3ListBoxItem (Q3ListBox * listbox , Q3ListBoxItem * after ) | |
| virtual | ~Q3ListBoxItem () |
| bool | current () const |
| virtual int | height (const Q3ListBox * lb ) const |
| bool | isCurrent () const |
| bool | isSelectable () const |
| bool | isSelected () const |
| Q3ListBox * | listBox () const |
| Q3ListBoxItem * | next () const |
| virtual const QPixmap * | pixmap () const |
| Q3ListBoxItem * | prev () const |
| virtual int | rtti () const |
| bool | selected () const |
| void | setSelectable (bool b ) |
| virtual QString | text () const |
| virtual int | width (const Q3ListBox * lb ) const |
| virtual void | paint (QPainter * p ) = 0 |
| void | setCustomHighlighting (bool b ) |
| virtual void | setText (const QString & text ) |
The Q3ListBoxItem class is the base class of all list box items.
This class is an abstract base class used for all list box items. If you need to insert customized items into a Q3ListBox you must inherit this class and reimplement paint (), height () 和 width ().
另请参阅 Q3ListBox .
Constructs an empty list box item in the list box listbox .
Constructs an empty list box item in the list box listbox and inserts it after the item after or at the beginning if after 为 0。
[虚拟]
Q3ListBoxItem::
~Q3ListBoxItem
()
Destroys the list box item.
使用 isCurrent () instead. Returns true if isCurrent () returns true.
[虚拟]
int
Q3ListBoxItem::
height
(const
Q3ListBox
*
lb
) const
Implement this function to return the height of your item. The lb parameter is the same as listBox () and is provided for convenience and compatibility.
默认实现返回 QApplication::globalStrut ()'s height.
Returns true if the item is the current item; otherwise returns false.
另请参阅 Q3ListBox::currentItem (), Q3ListBox::item (),和 isSelected ().
Returns true if this item is selectable (the default); otherwise returns false.
另请参阅 setSelectable ().
Returns true if the item is selected; otherwise returns false.
另请参阅 Q3ListBox::isSelected () 和 isCurrent ().
Returns a pointer to the list box containing this item.
Returns the item that comes after this in the list box. If this is the last item, 0 is returned.
另请参阅 prev ().
[pure virtual protected]
void
Q3ListBoxItem::
paint
(
QPainter
*
p
)
Implement this function to draw your item. The painter, p , is already open for painting.
[虚拟]
const
QPixmap
* Q3ListBoxItem::
pixmap
() const
Returns the pixmap associated with the item, or 0 if there isn't one.
The default implementation returns 0.
Returns the item which comes before this in the list box. If this is the first item, 0 is returned.
另请参阅 next ().
[虚拟]
int
Q3ListBoxItem::
rtti
() const
Returns 0.
Make your derived classes return their own values for rtti(), and you can distinguish between listbox items. You should use values greater than 1000 preferably a large random number, to allow for extensions to this class.
使用 isSelected () instead. Returns true if isSelected () returns true.
[protected]
void
Q3ListBoxItem::
setCustomHighlighting
(
bool
b
)
Defines whether the list box item is responsible for drawing itself in a highlighted state when being selected.
若 b is false (the default), the list box will draw some default highlight indicator before calling paint ().
另请参阅 isSelected () 和 paint ().
若 b is true (the default) then this item can be selected by the user; otherwise this item cannot be selected by the user.
另请参阅 isSelectable ().
[virtual protected]
void
Q3ListBoxItem::
setText
(const
QString
&
text
)
Sets the text of the Q3ListBoxItem to text 。此 text is also used for sorting. The text is not shown unless explicitly drawn in paint ().
另请参阅 text ().
[虚拟]
QString
Q3ListBoxItem::
text
() const
Returns the text of the item. This text is also used for sorting.
另请参阅 setText ().
[虚拟]
int
Q3ListBoxItem::
width
(const
Q3ListBox
*
lb
) const
Reimplement this function to return the width of your item. The lb parameter is the same as listBox () and is provided for convenience and compatibility.
默认实现返回 QApplication::globalStrut ()'s width.