PDA

View Full Version : QCombobox showPopup problem



SailinShoes
20th August 2008, 13:49
I develop for an embedded system, ARM9 with Qt Embedded 4.2.

I have a combobox delegate and when the editor is opened the combobox
is shown on top and the popup view is below. I just want the popup view list
to be visible?

When I run the same code on my laptop (X11) only the popup view is visible as I want it to be?

This is the constructor for the combobox...


BatchComboBox::BatchComboBox(QWidget *parent)
: QComboBox(parent)
{

view()->installEventFilter(this);

addItem(BATCH_ON);
addItem(BATCH_OFF);

}


...and the setEditor of the delegate.


void PSetItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{

BatchComboBox *comboBox = static_cast<BatchComboBox*>(editor);

QString str = index.model()->data(index, (int) Qt::DisplayRole).toString();
int value = comboBox->findText(str, Qt::MatchExactly);

comboBox->setCurrentIndex(value);
comboBox->showPopup();

}

wysota
21st August 2008, 07:40
Maybe you want to use QListWidget or QListView for your editor instead?

SailinShoes
21st August 2008, 11:16
Yes I have thought of that solution. Seems to be the easiest way to get it done.