Source Code (Use browser search to find items of interest.)
Class Index
qt'QListBoxItem (./qt-2.1.0/src/widgets/qlistbox.h:294)
class Q_EXPORT QListBoxItem
{
public:
QListBoxItem( QListBox* listbox = 0);
QListBoxItem( QListBox* listbox, QListBoxItem *after);
virtual ~QListBoxItem();
virtual QString text() const;
virtual const QPixmap *pixmap() const;
virtual int height( const QListBox * ) const;
virtual int width( const QListBox * ) const;
bool selected() const { return s; }
bool current() const;
QListBox *listBox() const;
void setSelectable( bool b );
bool isSelectable() const;
QListBoxItem *next() const;
QListBoxItem *prev() const;
protected:
virtual void paint( QPainter * ) = 0;
virtual void setText( const QString &text ) { txt = text; }
void setCustomHighlighting( bool );
private:
QString txt;
uint s:1;
uint dirty:1;
uint custom_highlight : 1;
int x, y;
QListBoxItem * p, * n;
QListBox* lbox;
friend class QListBox;
friend class QListBoxPrivate;
friend class QComboBox;
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
QListBoxItem( const QListBoxItem & );
QListBoxItem &operator=( const QListBoxItem & );
#endif
};
qt'QListBoxItem::QListBoxItem() (./qt-2.1.0/src/widgets/qlistbox.cpp:142)
QListBoxItem::QListBoxItem( QListBox* listbox )
{
lbox = listbox;
s = FALSE;
dirty = TRUE;
custom_highlight = FALSE;
p = n = 0;
// just something that'll look noticeable in the debugger
x = y = 42;
if (listbox)
listbox->insertItem( this );
}
/*!
Constructs an empty list box item in the listbox \a listbox and
inserts it after the item \a after.
*/
qt'QListBoxItem::QListBoxItem() (./qt-2.1.0/src/widgets/qlistbox.cpp:162)
QListBoxItem::QListBoxItem( QListBox* listbox, QListBoxItem *after )
{
lbox = listbox;
s = FALSE;
dirty = TRUE;
custom_highlight = FALSE;
p = n = 0;
// just something that'll look noticeable in the debugger
x = y = 42;
if (listbox)
listbox->insertItem( this, after );
}
/*!
Destroys the list box item.
*/
qt'QListBoxItem::~QListBoxItem() (./qt-2.1.0/src/widgets/qlistbox.cpp:182)
QListBoxItem::~QListBoxItem()
{
if ( lbox )
lbox->takeItem( this );
}
/*!
Defines whether the list box items is responsible to draw itself
in a highlighted state when being selected.
If \a b is FALSE (the default), then the listbox will draw some
default highlight indicator before calling paint().
\sa selected(), paint()
*/
qt'QListBoxItem::setCustomHighlighting() (./qt-2.1.0/src/widgets/qlistbox.cpp:198)
void QListBoxItem::setCustomHighlighting( bool b )
{
custom_highlight = b;
}
/*!
\fn void QListBoxItem::paint( QPainter *p )
Implement this function to draw your item.
\sa height(), width()
*/
/*!
\fn int QListBoxItem::width( const QListBox* lb ) const
Implement this function to return the width of your item.
The \a lb parameter is the same as listBox() and is provided
for convenience and compatibility.
\sa paint(), height()
*/
qt'QListBoxItem::width() (./qt-2.1.0/src/widgets/qlistbox.cpp:220)
int QListBoxItem::width(const QListBox*) const
{
return 0;
}
/*!
\fn int QListBoxItem::height( const QListBox* lb ) const
Implement this function to return the height of your item.
The \a lb parameter is the same as listBox() and is provided
for convenience and compatibility.
\sa paint(), width()
*/
qt'QListBoxItem::height() (./qt-2.1.0/src/widgets/qlistbox.cpp:234)
int QListBoxItem::height(const QListBox*) const
{
return 0;
}
/*!
Returns the text of the item, which is used for sorting too.
\sa setText()
*/
qt'QListBoxItem::text() (./qt-2.1.0/src/widgets/qlistbox.cpp:245)
QString QListBoxItem::text() const
{
return txt;
}
/*!
Returns the pixmap connected with the item, if any.
The default implementation of this function returns a null pointer.
*/
qt'QListBoxItem::pixmap() (./qt-2.1.0/src/widgets/qlistbox.cpp:255)
const QPixmap *QListBoxItem::pixmap() const
{
return 0;
}
/*!
Specifies if this item may be selected by the user or not.
*/
qt'QListBoxItem::setSelectable() (./qt-2.1.0/src/widgets/qlistbox.cpp:264)
void QListBoxItem::setSelectable( bool b )
{
if ( !listBox() )
return;
bool *sel = listBox()->d->selectable.find( this );
if ( !sel )
listBox()->d->selectable.insert( this, new bool( b ) );
else
listBox()->d->selectable.replace( this, new bool( b ) );
}
/*!
Returns if this item is selectable or not.
\sa setSelectable()
*/
qt'QListBoxItem::isSelectable() (./qt-2.1.0/src/widgets/qlistbox.cpp:281)
bool QListBoxItem::isSelectable() const
{
if ( !listBox() )
return TRUE;
bool *sel = listBox()->d->selectable.find( ( (QListBoxItem*)this ) );
if ( !sel )
return TRUE;
else
return *sel;
}
/*!
\fn void QListBoxItem::setText( const QString &text )
Sets the text of the widget, which is used for sorting too.
The text is not shown unless explicitly drawn in paint().
\sa text()
*/
/*!
\class QListBoxText qlistbox.h
\brief The QListBoxText class provides list box items with text.
The text is drawn in the widget's current font. If you need several
different fonts, you have to make your own subclass of QListBoxItem.
\sa QListBox, QListBoxItem
*/
/*!
Constructs a list box item in listbox \a listtbox showing the text \a text.
*/
qt'QListBoxItem::current() (./qt-2.1.0/src/widgets/qlistbox.cpp:3589)
bool QListBoxItem::current() const
{
return listBox() && listBox()->hasFocus() &&
listBox()->item( listBox()->currentItem() ) == this;
}
/*! \fn void QListBox::centerCurrentItem()
If there is a current item, the listbox is scrolled,
so that this item is displayed centered.
\sa QListBox::ensureCurrentVisible()
*/
/*! Returns a pointer to the listbox containing this item.
*/
qt'QListBoxItem::listBox() (./qt-2.1.0/src/widgets/qlistbox.cpp:3606)
QListBox * QListBoxItem::listBox() const
{
return lbox;
}
/*!
Removes \a item from the listbox and causes an update of the screen
display. The item is not deleted. You should normally not need to
call this function, as QListBoxItem::~QListBoxItem() calls it. The
normal way to delete an item is \c delete.
\sa QListBox::insertItem()
*/
qt'QListBoxItem::next() (./qt-2.1.0/src/widgets/qlistbox.cpp:3772)
QListBoxItem *QListBoxItem::next() const
{
return n;
}
/*!
Returns the item which comes before this in the
listbox. If this is the first item, 0 is returned.
*/
qt'QListBoxItem::prev() (./qt-2.1.0/src/widgets/qlistbox.cpp:3782)
QListBoxItem *QListBoxItem::prev() const
{
return p;
}
/*!
Returns the first item of this listbox.
*/