Eneboo - Documentación para desarrolladores
|
The QCheckListItem class provides checkable list view items. Más...
#include <qlistview.h>
The QCheckListItem class provides checkable list view items.
QCheckListItems are used in {QListView}s to provide {QListViewItem}s that are checkboxes, radio buttons or controllers.
Checkbox and controller check list items may be inserted at any level in a list view. Radio button check list items must be children of a controller check list item.
The item can be checked or unchecked with setOn(). Its type can be retrieved with type() and its text retrieved with text().
qlistviewitems.png List View Items
enum QCheckListItem::Type |
enum QCheckListItem::Type |
This enum type specifies a QCheckListItem's type:
RadioButton CheckBox Controller obsolete (use RadioButtonController
instead) RadioButtonController CheckBoxController
QCheckListItem::QCheckListItem | ( | QCheckListItem * | parent, |
const QString & | text, | ||
Type | tt = RadioButtonController |
||
) |
Constructs a checkable item with parent parent, text text and of type tt. Note that a RadioButton
must be the child of a RadioButtonController
, otherwise it will not toggle.
QCheckListItem::QCheckListItem | ( | QCheckListItem * | parent, |
QListViewItem * | after, | ||
const QString & | text, | ||
Type | tt = RadioButtonController |
||
) |
Constructs a checkable item with parent parent, which is after after in the parent's list of children, and with text text and of type tt. Note that a RadioButton
must be the child of a RadioButtonController
, otherwise it will not toggle.
QCheckListItem::QCheckListItem | ( | QListViewItem * | parent, |
const QString & | text, | ||
Type | tt = RadioButtonController |
||
) |
Constructs a checkable item with parent parent, text text and of type tt. Note that this item must not be a RadioButton
. Radio buttons must be children of a RadioButtonController
.
QCheckListItem::QCheckListItem | ( | QListViewItem * | parent, |
QListViewItem * | after, | ||
const QString & | text, | ||
Type | tt = RadioButtonController |
||
) |
Constructs a checkable item with parent parent, which is after after in the parent's list of children, with text text and of type tt. Note that this item must not be a RadioButton
. Radio buttons must be children of a RadioButtonController
.
QCheckListItem::QCheckListItem | ( | QListView * | parent, |
const QString & | text, | ||
Type | tt = RadioButtonController |
||
) |
Constructs a checkable item with parent parent, text text and of type tt. Note that tt must not be RadioButton
. Radio buttons must be children of a RadioButtonController
.
QCheckListItem::QCheckListItem | ( | QListView * | parent, |
QListViewItem * | after, | ||
const QString & | text, | ||
Type | tt = RadioButtonController |
||
) |
Constructs a checkable item with parent parent, which is after after in the parent's list of children, with text text and of type tt. Note that tt must not be RadioButton
. Radio buttons must be children of a RadioButtonController
.
QCheckListItem::QCheckListItem | ( | QListViewItem * | parent, |
const QString & | text, | ||
const QPixmap & | p | ||
) |
Constructs a RadioButtonController
item with parent parent, text text and pixmap p.
Constructs a RadioButtonController
item with parent parent, text text and pixmap p.
QCheckListItem::~QCheckListItem | ( | ) |
Destroys the item, and all its children to any depth, freeing up all allocated resources.
QCheckListItem::QCheckListItem | ( | QCheckListItem * | parent, |
const QString & | text, | ||
Type | = RadioButtonController |
||
) |
QCheckListItem::QCheckListItem | ( | QCheckListItem * | parent, |
QListViewItem * | after, | ||
const QString & | text, | ||
Type | = RadioButtonController |
||
) |
QCheckListItem::QCheckListItem | ( | QListViewItem * | parent, |
const QString & | text, | ||
Type | = RadioButtonController |
||
) |
QCheckListItem::QCheckListItem | ( | QListViewItem * | parent, |
QListViewItem * | after, | ||
const QString & | text, | ||
Type | = RadioButtonController |
||
) |
QCheckListItem::QCheckListItem | ( | QListView * | parent, |
const QString & | text, | ||
Type | = RadioButtonController |
||
) |
QCheckListItem::QCheckListItem | ( | QListView * | parent, |
QListViewItem * | after, | ||
const QString & | text, | ||
Type | = RadioButtonController |
||
) |
QCheckListItem::QCheckListItem | ( | QListViewItem * | parent, |
const QString & | text, | ||
const QPixmap & | |||
) |
QCheckListItem::~QCheckListItem | ( | ) |
void QCheckListItem::activate | ( | ) | [protected, virtual] |
Toggle check box or set radio button to on.
Reimplementado de QListViewItem.
void QCheckListItem::activate | ( | ) | [protected, virtual] |
This virtual function is called whenever the user presses the mouse on this item or presses Space on it.
Reimplementado de QListViewItem.
bool QCheckListItem::isOn | ( | ) | const [inline] |
bool QCheckListItem::isOn | ( | ) | const [inline] |
Returns TRUE if the item is toggled on; otherwise returns FALSE.
bool QCheckListItem::isTristate | ( | ) | const |
Returns TRUE if the item is tristate; otherwise returns FALSE.
bool QCheckListItem::isTristate | ( | ) | const |
void QCheckListItem::paintCell | ( | QPainter * | p, |
const QColorGroup & | cg, | ||
int | column, | ||
int | width, | ||
int | align | ||
) | [virtual] |
This virtual function paints the contents of one column of an item and aligns it as described by align.
p is a QPainter open on the relevant paint device. p is translated so (0, 0) is the top-left pixel in the cell and width-1, height()-1 is the bottom-right pixel in the cell. The other properties of p (pen, brush, etc) are undefined. cg is the color group to use. column is the logical column number within the item that is to be painted; 0 is the column which may contain a tree.
This function may use QListView::itemMargin() for readability spacing on the left and right sides of data such as text, and should honor isSelected() and QListView::allColumnsShowFocus().
If you reimplement this function, you should also reimplement width().
The rectangle to be painted is in an undefined state when this function is called, so you must draw on all the pixels. The painter p has the right font on entry.
Reimplementado de QListViewItem.
void QCheckListItem::paintCell | ( | QPainter * | p, |
const QColorGroup & | cg, | ||
int | column, | ||
int | width, | ||
int | align | ||
) | [virtual] |
Paints the item using the painter p and the color group cg. The item is in column column, has width width and has alignment align. (See Qt::AlignmentFlags for valid alignments.)
Reimplementado de QListViewItem.
virtual void QCheckListItem::paintFocus | ( | QPainter * | p, |
const QColorGroup & | cg, | ||
const QRect & | r | ||
) | [virtual] |
Paints a focus indicator on the rectangle r using painter p and colors cg.
p is already clipped.
Reimplementado de QListViewItem.
void QCheckListItem::paintFocus | ( | QPainter * | p, |
const QColorGroup & | cg, | ||
const QRect & | r | ||
) | [virtual] |
Draws the focus rectangle r using the color group cg on the painter p.
Reimplementado de QListViewItem.
int QCheckListItem::rtti | ( | ) | const [virtual] |
Returns 0.
Make your derived classes return their own values for rtti(), so that you can distinguish between different kinds of list view items. You should use values greater than 1000 to allow for extensions to this class.
Reimplementado de QListViewItem.
int QCheckListItem::rtti | ( | ) | const [virtual] |
Returns 1.
Make your derived classes return their own values for rtti(), and you can distinguish between list view items. You should use values greater than 1000, to allow for extensions to this class.
Reimplementado de QListViewItem.
virtual void QCheckListItem::setOn | ( | bool | ) | [virtual] |
void QCheckListItem::setOn | ( | bool | b | ) | [virtual] |
Sets the button on if b is TRUE, otherwise sets it off. Maintains radio button exclusivity.
void QCheckListItem::setState | ( | ToggleState | s | ) |
Sets the toggle state of the checklistitem to s. s can be Off
, NoChange
or On
.
Tristate can only be enabled for CheckBox
or CheckBoxController
, therefore the NoChange
only applies to them.
Setting the state to On
or Off
on a CheckBoxController
will recursivly set the states of its children to the same state.
Setting the state to NoChange
on a CheckBoxController
will make it recursivly recall the previous stored state of its children. If there was no previous stored state the children are all set to On
.
void QCheckListItem::setState | ( | ToggleState | s | ) |
void QCheckListItem::setTristate | ( | bool | b | ) |
Sets tristate to b if the Type
is either a CheckBoxController
or a CheckBox
.
CheckBoxControllers
are tristate by default.
void QCheckListItem::setTristate | ( | bool | ) |
void QCheckListItem::setup | ( | void | ) | [virtual] |
Reimplementado de QListViewItem.
void QCheckListItem::setup | ( | void | ) | [virtual] |
This virtual function is called before the first time QListView needs to know the height or any other graphical attribute of this object, and whenever the font, GUI style, or colors of the list view change.
The default calls widthChanged() and sets the item's height to the height of a single line of text in the list view's font. (If you use icons, multi-line text, etc., you will probably need to call setHeight() yourself or reimplement it.)
Reimplementado de QListViewItem.
QCheckListItem::ToggleState QCheckListItem::state | ( | ) | const |
Returns the state of the item.
ToggleState QCheckListItem::state | ( | ) | const |
void QCheckListItem::stateChange | ( | bool | ) | [protected, virtual] |
This virtual function is called when the item changes its state. NoChange
(if tristate is enabled and the type is either CheckBox
or CheckBoxController
) reports the same as Off
, so use state() to determine if the state is actually Off
or NoChange
.
virtual void QCheckListItem::stateChange | ( | bool | ) | [protected, virtual] |
Returns the text in column column, or QString::null if there is no text in that column.
Reimplementado de QListViewItem.
QString QCheckListItem::text | ( | ) | const [inline] |
Returns the item's text.
QString QCheckListItem::text | ( | ) | const [inline] |
Reimplementado de QListViewItem.
void QCheckListItem::turnOffChild | ( | ) | [protected] |
void QCheckListItem::turnOffChild | ( | ) | [protected] |
If this is a RadioButtonController
that has RadioButton
children, turn off the child that is on.
QCheckListItem::Type QCheckListItem::type | ( | ) | const [inline] |
Returns the type of this item.
Type QCheckListItem::type | ( | ) | const [inline] |
int QCheckListItem::width | ( | const QFontMetrics & | fm, |
const QListView * | lv, | ||
int | c | ||
) | const [virtual] |
Returns the number of pixels of width required to draw column c of list view lv, using the metrics fm without cropping. The list view containing this item may use this information depending on the QListView::WidthMode settings for the column.
The default implementation returns the width of the bounding rectangle of the text of column c.
Reimplementado de QListViewItem.
int QCheckListItem::width | ( | const QFontMetrics & | fm, |
const QListView * | lv, | ||
int | column | ||
) | const [virtual] |
Reimplementado de QListViewItem.
static int QCheckListItem::RTTI = 1 [static] |
Reimplementado de QListViewItem.