QList<TimeInterval*> IntervalEditImpl::intervals() const { QList<TimeInterval*> l; int cnt = intervalList->topLevelItemCount(); for (int i=0; i < cnt; ++i) { IntervalItem *item = static_cast<IntervalItem*>(intervalList->topLevelItem(i)); l.append(new TimeInterval(item->interval().first, item->interval().second)); } return l; }
void IntervalEditImpl::slotIntervalSelectionChanged() { QList<QTreeWidgetItem*> lst = intervalList->selectedItems(); if (lst.count() == 0) return; IntervalItem *ii = static_cast<IntervalItem *>(lst[0]); startTime->setTime(ii->interval().first); length->setValue((double)(ii->interval().second) / (1000.*60.*60.)); enableButtons(); }