一杯清酒邀明月
天下本无事,庸人扰之而烦耳。

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 }

 

posted on 2021-02-20 12:04  一杯清酒邀明月  阅读(3897)  评论(0编辑  收藏  举报

/* 看板娘 */