]> git.sesse.net Git - kdenlive/blobdiff - src/keyframeedit.cpp
Fixed: Crash when selecting a keyframeable effect
[kdenlive] / src / keyframeedit.cpp
index cc050c181702343be318334f0081d7dc870beb14..b93182911e2b01326f972d800643653003e78193 100644 (file)
@@ -119,15 +119,16 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe)
             m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt(),
             m_params.at(columnId).attribute("default").toInt(), comment, m_params.at(columnId).attribute("suffix"), this);
     connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
-    connect(this, SIGNAL(showComments()), doubleparam, SLOT(slotShowComment()));
+    connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
     m_slidersLayout->addWidget(doubleparam, columnId, 0);
 
     QRadioButton *radio = new QRadioButton(this);
+    radio->setToolTip(i18n("Show %1 in timeline").arg(paramName));
     m_showButtons->addButton(radio, columnId);
     if (e.attribute("intimeline") == "1")
         radio->setChecked(true);
 
-    QVBoxLayout *radioLayout = new QVBoxLayout(this);
+    QVBoxLayout *radioLayout = new QVBoxLayout;
     radioLayout->addWidget(radio, 0, Qt::AlignTop);
     m_slidersLayout->addLayout(radioLayout, columnId, 1);
 
@@ -203,8 +204,14 @@ void KeyframeEdit::slotAddKeyframe()
             result = m_min;
         }
     } else {
-        int pos2 = getPos(row - 1);
-        result = pos2 + (pos1 - pos2) / 2;
+        if (pos1 < m_max - 1) {
+            // last keyframe selected and it is not at end of clip -> add keyframe at the end
+            result = m_max - 1;
+            newrow++;
+        } else {
+            int pos2 = getPos(row - 1);
+            result = pos2 + (pos1 - pos2) / 2;
+        }
     }
 
     keyframe_list->insertRow(newrow);
@@ -372,7 +379,7 @@ void KeyframeEdit::slotAdjustKeyframeValue(int value)
             continue;
         int val = doubleparam->getValue();
         QTableWidgetItem *nitem = keyframe_list->item(item->row(), col);
-        if (nitem->text().toInt() != val)
+        if (nitem && nitem->text().toInt() != val)
             nitem->setText(QString::number(val));
     }
     //keyframe_list->item(item->row() - 1, item->column());
@@ -457,8 +464,8 @@ void KeyframeEdit::checkVisibleParam()
             return;
     }
 
-    slotUpdateVisibleParameter(0, false);
-    QRadioButton *radio = static_cast<QRadioButton*>(m_slidersLayout->itemAtPosition(0, 1)->widget());
+    slotUpdateVisibleParameter(0);
+    QRadioButton *radio = static_cast<QRadioButton*>(m_slidersLayout->itemAtPosition(0, 1)->layout()->itemAt(0)->widget());
     if (radio)
         radio->setChecked(true);
 }