PDA

View Full Version : Combo with cascading list



navi1084
16th February 2010, 13:38
Hi,
I am developing a control where combo contains QColumnView as popup. I have attached the png of Preview(ComboBox.png).
I have used QStandartItemModel to have multilevel item list and added into the QColumnView using setModel(). Using setView() of QComboBox i am inserting the QColumnView instance. but while poping down it display the normal popup which contain the normal list box instead of column view. Can any one tell me how can i resolve this.

I have attached the source code. Can anyone please update the code.

Thank you.

spirit
16th February 2010, 13:53
set minimum size for QColumnView, e.g.


m_ColumnView->setMinimumSize(400, 400);

spirit
16th February 2010, 14:15
or you can make more flexible


...
m_ComboBox->setView(m_ColumnView);
m_ComboBox->view()->setCornerWidget(new QSizeGrip(m_ColumnView));
m_ComboBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
...

navi1084
17th February 2010, 05:20
Thank you for the reply this works fine. But when i select the child item of first item, then it creates 3rd column in QColumnView. Is there any way to avoid third column. Because i need only two column to be created.

Or is there any other way to create these control.