PDA

View Full Version : Changin look of QComboTableItem



jseguraj
20th November 2006, 10:40
I have a QTable for input data and calculate radiators for heating.
In that table i use QComboTableItem's where the user can select the radiator to install. I would like that the QComboTableItem's looks like a single cell (only text, no controlls) when the focus leaves the cell and combo apears when the cell is focused. I remember have seen that behaviour for "combo cells" in other application.
By other hand, how can i recalculate prices etc like spreadsheet when QComboTableItem is changed? QComboTableItem doesn't emit the activated signal

This is my first post in this forum and i'm spanish, so sorry by my english
Thanks

jacek
21st November 2006, 13:35
I would like that the QComboTableItem's looks like a single cell (only text, no controlls) when the focus leaves the cell and combo apears when the cell is focused.
Then maybe you need a regular table item that uses QComboBox as an editor?

You have to subclass QTableItem and reimplement QTableItem::createEditor() (there's an example in the docs that actually does what you want).


By other hand, how can i recalculate prices etc like spreadsheet when QComboTableItem is changed? QComboTableItem doesn't emit the activated signal
You can use QTable::valueChanged() (http://doc.trolltech.com/3.3/qtable.html#valueChanged) signal.