
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3ComboTableItem class provides a means of using comboboxes in Q3Tables.More...
| Header: | #include <Q3ComboTableItem> |
| Inherits: | Q3TableItem |
| Q3ComboTableItem(Q3Table * table, const QStringList & list, bool editable = false) | |
| ~Q3ComboTableItem() | |
| int | count() const |
| int | currentItem() const |
| QString | currentText() const |
| bool | isEditable() const |
| virtual void | setCurrentItem(int i) |
| virtual void | setCurrentItem(const QString & s) |
| virtual void | setEditable(bool b) |
| virtual void | setStringList(const QStringList & l) |
| QString | text(int i) const |
| virtual QWidget * | createEditor() const |
| virtual void | paint(QPainter * p, const QColorGroup & cg, const QRect & cr, bool selected) |
| virtual int | rtti() const |
| virtual void | setContentFromEditor(QWidget * w) |
| virtual QSize | sizeHint() const |
| virtual QString | text() const |
TheQ3ComboTableItem class provides a means of using comboboxes in Q3Tables.
AQ3ComboTableItem is a table item which looks and behaves like a combobox. The advantage of using Q3ComboTableItems rather than real comboboxes is that aQ3ComboTableItem uses far less resources than real comboboxes inQ3Tables. When the cell has the focus it displays a real combobox which the user can interact with. When the cell does not have the focus the celllooks like a combobox. Only text items (i.e. no pixmaps) may be used in Q3ComboTableItems.
Q3ComboTableItem items have the edit typeWhenCurrent (seeEditType). TheQ3ComboTableItem's list of items is provided by aQStringList passed to the constructor.
The list of items may be changed usingsetStringList(). The current item can be set withsetCurrentItem() and retrieved withcurrentItem(). The text of the current item can be obtained withcurrentText(), and the text of a particular item can be retrieved withtext().
IfisEditable() is true theQ3ComboTableItem will permit the user to either choose an existing list item, or create a new list item by entering their own text; otherwise the user may only choose one of the existing list items.
To populate a table cell with aQ3ComboTableItem useQ3Table::setItem().
Q3ComboTableItems may be deleted withQ3Table::clearCell().
Q3ComboTableItems can be distinguished fromQ3TableItems andQ3CheckTableItems using their Run Time Type Identification number (seertti()).

See alsoQ3CheckTableItem,Q3TableItem, andQ3ComboBox.
Creates a combo table item for the tabletable. The combobox's list of items is passed in thelist argument. Ifeditable is true the user may type in new list items; ifeditable is false the user may only select from the list of items provided.
By default Q3ComboTableItems cannot be replaced by other table items sinceisReplaceable() returns false by default.
See alsoQ3Table::clearCell() andEditType.
Q3ComboTableItem destructor.
Returns the total number of list items in the combo table item.
[virtual]QWidget * Q3ComboTableItem::createEditor() constReimplemented fromQ3TableItem::createEditor().
Returns the index of the combo table item's current list item.
See alsosetCurrentItem().
Returns the text of the combo table item's current list item.
See alsocurrentItem() andtext().
Returns true if the user can add their own list items to the combobox's list of items; otherwise returns false.
See alsosetEditable().
[virtual]void Q3ComboTableItem::paint(QPainter * p, constQColorGroup & cg, constQRect & cr,bool selected)Reimplemented fromQ3TableItem::paint().
[virtual]int Q3ComboTableItem::rtti() constReimplemented fromQ3TableItem::rtti().
Returns 1.
Make your derived classes return their own values for rtti()to distinguish between different table item subclasses. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class.
See alsoQ3TableItem::rtti().
[virtual]void Q3ComboTableItem::setContentFromEditor(QWidget * w)Reimplemented fromQ3TableItem::setContentFromEditor().
[virtual]void Q3ComboTableItem::setCurrentItem(int i)Sets the list itemi to be the combo table item's current list item.
See alsocurrentItem().
[virtual]void Q3ComboTableItem::setCurrentItem(constQString & s)This is an overloaded function.
Sets the list item whose text iss to be the combo table item's current list item. Does nothing if no list item has the texts.
See alsocurrentItem().
[virtual]void Q3ComboTableItem::setEditable(bool b)Ifb is true the combo table item can be edited, i.e. the user may enter a new text item themselves. Ifb is false the user may may only choose one of the existing items.
See alsoisEditable().
[virtual]void Q3ComboTableItem::setStringList(constQStringList & l)Sets the list items of thisQ3ComboTableItem to the strings in the string listl.
[virtual]QSize Q3ComboTableItem::sizeHint() constReimplemented fromQ3TableItem::sizeHint().
[virtual]QString Q3ComboTableItem::text() constReimplemented fromQ3TableItem::text().
Returns the text of the table item or an empty string if there is no text.
See alsoQ3TableItem::text().
Returns the text of the combo's list item at indexi.
See alsocurrentText().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.