PDA

View Full Version : QComboBox dropdown Height



minsoub
23rd February 2010, 07:19
Version : Qt 4.6.0
OS : Linux

I tried setting QComboBox Height.

Qt Code :


QComboBox *cbo = new QComboBox;
QSqlQueryModel *model = new QSqlQueryModel;

....

cbo->clear();
cbo->setModel(model);
cbo->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
cbo->view()->setFixedHeight(100);

If it's code execute, then QComboBox's area overflowed in window screen.


Any suggestions?
( please show to me the short example ...
I'm beginer Qt.
)

Thanks.

Lykurg
23rd February 2010, 07:38
( please show to me the short example ...
I'm beginer Qt.
)
Then you should use our Newbie section... See QComboBox::completer() and QCompleter::setMaxVisibleItems().

minsoub
23rd February 2010, 08:02
First of all, thanks to your answer.

I tried coding something like :

QComboBox *cbo = new QComboBox;
QSqlQueryModel *model = new QSqlQueryModel;

....

cbo->clear();
cbo->setModel(model);

cbo->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

QCompleter *p = new QCompleter(icao_cdModel);
p->setMaxVisibleItems(20);
cboIcao_cd->setCompleter(p);
-----------------------------------------------------------------------------------------
but the results is equlas above question.

Please show to me detail the solution.

thanks.