Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

Q3ComboTableItem Class

TheQ3ComboTableItem class provides a means of using comboboxes in Q3Tables.More...

Header:#include <Q3ComboTableItem>
Inherits:Q3TableItem

Public Functions

Q3ComboTableItem(Q3Table * table, const QStringList & list, bool editable = false)
~Q3ComboTableItem()
intcount() const
intcurrentItem() const
QStringcurrentText() const
boolisEditable() const
virtual voidsetCurrentItem(int i)
virtual voidsetCurrentItem(const QString & s)
virtual voidsetEditable(bool b)
virtual voidsetStringList(const QStringList & l)
QStringtext(int i) const

Reimplemented Public Functions

virtual QWidget *createEditor() const
virtual voidpaint(QPainter * p, const QColorGroup & cg, const QRect & cr, bool selected)
virtual intrtti() const
virtual voidsetContentFromEditor(QWidget * w)
virtual QSizesizeHint() const
virtual QStringtext() const

Detailed Description

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()).

Table Items

See alsoQ3CheckTableItem,Q3TableItem, andQ3ComboBox.

Member Function Documentation

Q3ComboTableItem::Q3ComboTableItem(Q3Table * table, constQStringList & list,bool editable = false)

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::~Q3ComboTableItem()

Q3ComboTableItem destructor.

int Q3ComboTableItem::count() const

Returns the total number of list items in the combo table item.

[virtual]QWidget * Q3ComboTableItem::createEditor() const

Reimplemented fromQ3TableItem::createEditor().

int Q3ComboTableItem::currentItem() const

Returns the index of the combo table item's current list item.

See alsosetCurrentItem().

QString Q3ComboTableItem::currentText() const

Returns the text of the combo table item's current list item.

See alsocurrentItem() andtext().

bool Q3ComboTableItem::isEditable() const

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() const

Reimplemented 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() const

Reimplemented fromQ3TableItem::sizeHint().

[virtual]QString Q3ComboTableItem::text() const

Reimplemented fromQ3TableItem::text().

Returns the text of the table item or an empty string if there is no text.

See alsoQ3TableItem::text().

QString Q3ComboTableItem::text(int i) const

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.


[8]ページ先頭

©2009-2025 Movatter.jp