QT4.8说明文档:
This property is ignored for non-editable comboboxes in styles that returns true for QStyle::SH_ComboBox_Popup such as the Mac style or the Gtk+ Style.
首先更改程序界面风格,可能其他风格也可以通过(只测试了这一种)
Qapplication::setStyle(QStyleFactory::create("Fusion");
设置可编辑
setEditable(true);
设置最多可见数
setMaxVisibleItems(5);