Qt-interest Archive, December 2007
QComboBox showPopup() in QItemDelegate::setEditorData()
Message 1 in thread
I have a QItemDelegate I'm using with a QTableWidget that uses a
QComboBox as an editor for one of the fields. When a user triggers the
editor (by double clicking), I want to not only show the QComboBox but
also popup its list with QComboBox::showPopup(). So I do this in
setEditorData():
comboBox->clear();
comboBox->addItems( index.data( StringListDataRole ).toStringList() );
comboBox->setCurrentIndex(0);
comboBox->showPopup();
When the user double clicks, the QComboBox appears in the cell, and the
popup appears for a brief moment, but then closes almost immediately. I
can open it again by clicking once on the QComboBox (like normal). I've
tried using eventFilter() in my QItemDelegate to filter out certain
events so the parent QItemDelegate class doesn't handle them for my
QComboBox, but to no avail.
Any ideas how I can make my QComboBox's popup *not* disappear?
Thanks in advance.
--Dave
--
[ signature omitted ]
Message 2 in thread
On Wed, 2007-12-26 at 16:34 -0700, Dave Smith wrote:
> I have a QItemDelegate I'm using with a QTableWidget that uses a
> QComboBox as an editor for one of the fields. When a user triggers the
> editor (by double clicking), I want to not only show the QComboBox but
> also popup its list with QComboBox::showPopup(). So I do this in
> setEditorData():
>
> comboBox->clear();
> comboBox->addItems( index.data( StringListDataRole ).toStringList() );
> comboBox->setCurrentIndex(0);
> comboBox->showPopup();
>
> When the user double clicks, the QComboBox appears in the cell, and the
> popup appears for a brief moment, but then closes almost immediately. I
> can open it again by clicking once on the QComboBox (like normal). I've
> tried using eventFilter() in my QItemDelegate to filter out certain
> events so the parent QItemDelegate class doesn't handle them for my
> QComboBox, but to no avail.
>
> Any ideas how I can make my QComboBox's popup *not* disappear?
>
> Thanks in advance.
I too would really be interested if someone knows of a solution to that
problem. I too have had the exact same identical issue and have not
found a solution as of yet.
Stephan
--
[ signature omitted ]