new KeyframePropertiesDialog is now accessible from any KeyframeViewBase derivative

This commit is contained in:
itsmattkc
2019-12-30 16:06:13 +11:00
parent 41927512e9
commit f7dd751b54
3 changed files with 25 additions and 0 deletions
@@ -3,6 +3,7 @@
#include <QMouseEvent>
#include <QVBoxLayout>
#include "dialog/keyframeproperties/keyframeproperties.h"
#include "keyframeviewundo.h"
#include "widget/menu/menu.h"
#include "widget/menu/menushared.h"
@@ -299,6 +300,11 @@ void KeyframeViewBase::ShowContextMenu()
break;
}
}
m.addSeparator();
QAction* properties_action = m.addAction(tr("P&roperties"));
connect(properties_action, &QAction::triggered, this, &KeyframeViewBase::ShowKeyframePropertiesDialog);
}
QAction* selected = m.exec(QCursor::pos());
@@ -329,6 +335,21 @@ void KeyframeViewBase::ShowContextMenu()
}
}
void KeyframeViewBase::ShowKeyframePropertiesDialog()
{
QList<QGraphicsItem*> items = scene()->selectedItems();
QList<NodeKeyframePtr> keys;
foreach (QGraphicsItem* item, items) {
keys.append(static_cast<KeyframeViewItem*>(item)->key());
}
if (!keys.isEmpty()) {
KeyframePropertiesDialog kd(keys, timebase(), this);
kd.exec();
}
}
void KeyframeViewBase::ApplicationToolChanged(Tool::Item tool)
{
if (tool == Tool::kHand) {
@@ -63,6 +63,8 @@ private:
private slots:
void ShowContextMenu();
void ShowKeyframePropertiesDialog();
void ApplicationToolChanged(Tool::Item tool);
};
@@ -44,6 +44,8 @@ NodeKeyframePtr KeyframeViewItem::key() const
void KeyframeViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::black);
if (option->state & QStyle::State_Selected) {