首页 > 其他 > 详细

Qt-QComboBoxg清空所有的方法

时间:2016-09-24 08:08:01      阅读:2376      评论:0      收藏:0      [点我收藏+]

1.clear()会清空关系,而且在我这会卡,很慢也不报错清完全要2分钟

2.我的方法:

 1  for (int i = 0; i < 7; i++)
 2         {
 3             // strListTemp << dt.addDays (i).toString (strDateFromat);
 4             ui.beginTime_comboBox->insertItem (i, dt.addDays (i).toString (strDateFromat));
 5             ui.endTime_comboBox->insertItem (i, dt.addDays (i).toString (strDateFromat));
 6         }
 7         
 8         ControlFunction::romoveAllItem (ui.beginTime_comboBox);
 9         ControlFunction::romoveAllItem (ui.endTime_comboBox);
10         ui.beginTime_comboBox->setCurrentIndex (0);
11         ui.endTime_comboBox->setCurrentIndex (ui.endTime_comboBox->count() - 1);
12         return true;
 1 void ControlFunction::romoveAllItem (QComboBox *cb)
 2 {
 3     int atemp = cb->count();
 4     
 5     for (; atemp >= 7; atemp--)
 6     {
 7         cb->removeItem (atemp);
 8         // cb->setItemText (atemp, "ddd");
 9     }
10 }

 

Qt-QComboBoxg清空所有的方法

原文:http://www.cnblogs.com/ants-double/p/5902341.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!