void KeyframeItem::swap(QListWidgetItem* oitem) {
  auto kfitem = static_cast<KeyframeItem*>(list_->itemWidget(oitem));
  auto kf = kfitem->keyframe();
  kfitem->updateKeyframe(keyframe_);
  updateKeyframe(kf);

  auto s = oitem->isSelected();
  oitem->setSelected(item_->isSelected());
  item_->setSelected(s);
}
void PropertyTimelineWidget::initConnections() {
    connect(propertyTimelineView_, SIGNAL(addKeyframe(QPointF)), this, SLOT(addKeyframeCore(QPointF)));
    connect(propertyTimelineView_, SIGNAL(clearTimeline()), this, SLOT(clearTimeline()));
    connect(propertyTimelineView_, SIGNAL(removeTimeline()), this, SLOT(removeTimeline()));
    connect(propertyTimelineView_, SIGNAL(noItemPressed(bool)), this, SLOT(disablePropertyWidget(bool)));
    connect(propertyTimelineView_, SIGNAL(snapshot(int, bool)), this, SLOT(snapshot(int, bool)));
    if(propertyWidget_ != 0) {
        connect(propertyWidget_, SIGNAL(widgetChanged()), this, SLOT(updateKeyframe()));
        connect(propertyWidget_, SIGNAL(modified()), this, SLOT(updateKeyframe()));
    }
}
void KeyframeItem::init(int row) {
  connect(txtName, SIGNAL(textChanged()), this, SLOT(updateName()));
  connect(spnFrames, SIGNAL(valueChanged(int)), this, SLOT(updateFrames(int)));
  connect(btnUp, SIGNAL(clicked()), this, SLOT(moveUp()));
  connect(btnDown, SIGNAL(clicked()), this, SLOT(moveDown()));
  updateKeyframe(keyframe_);
  
  list_ = static_cast<QListWidget*>(parent());
  item_ = createParentItem(row);
  
  deactivate();
}