View Full Version : QComboBox inside QTableWidget
campana
14th March 2006, 12:31
Hi to all
I've a question;
why in my QTableWidget with QComboBox cells I cannot use currentRow() function ?
There is a special Selection modality to set?
Thanks a lot
Manuel
campana
14th March 2006, 22:27
I want to be more precise:
when I select the QComboBox "cell" in my TableWidget
myTable->currentRow() returns me a 0xffffff value
:confused:
campana
19th March 2006, 01:45
Hi to all,
Why in my QTableWidget with a ComboBox cell the function QTableWidget::currentRow () doesn't work ???????
the function returns the correct int value only if i select the other colums (QTableWidgetItems)
Thanks in advance
Manuel
jpn
19th March 2006, 09:04
Well, interacting directly with the combo box does not change the "current" item in the table (unless you do it programmatically).
campana
19th March 2006, 12:48
But how i can do it ?
jpn
19th March 2006, 13:11
For example with an event filter..
Install this for all cell widgets in you table:
bool MyTableWidget::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::FocusIn && obj->isWidgetType())
{
QWidget* widget = qobject_cast<QWidget*>(obj);
if (widget)
{
QTableWidgetItem* item = itemAt(widget->pos());
if (item)
{
setCurrentItem(item);
}
}
}
return QTableWidget::eventFilter(obj, event);
}
campana
20th March 2006, 17:45
Sorry but I haven't understood very well your example :(
with this function i can analyze the object (for me is a certain cell ?) and an event, but which is the reason of that return (it's a recursive function ?)
Sorry for my late answer
Thanks
Bye
jpn
20th March 2006, 18:22
Sorry but I haven't understood very well your example :(
with this function i can analyze the object (for me is a certain cell ?) and an event, but which is the reason of that return (it's a recursive function ?)
Sorry for my late answer
Thanks
Bye
Unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.
http://doc.trolltech.com/4.1/qobject.html#eventFilter
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.