Commit 21382f01 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Add clickable field to copy automask keyframes. Fixes #23

parent 1bfca966
Pipeline #8115 passed with stage
in 22 minutes and 14 seconds
......@@ -27,6 +27,10 @@
<parameter type="bool" name="obscure" default="1">
<name>Obscure</name>
</parameter>
<parameter type="readonly" name="motion_vector_list" value="">
<name>Tracking data</name>
<comment>Click to copy to clipboard</comment>
</parameter>
<parameter type="filterjob" filtertag="autotrack_rectangle" filterparams="_serialize=1 motion_vector_list=0" consumer="null" consumerparams="all=1 terminate_on_pause=1">
<name>Analyse</name>
<jobparam name="storedata" />
......
......@@ -29,6 +29,8 @@
#include <QHBoxLayout>
#include <QClipboard>
#include <QLabel>
#include <QIcon>
#include <QToolButton>
#include <QApplication>
ClickableLabelParamWidget::ClickableLabelParamWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent)
......@@ -39,11 +41,20 @@ ClickableLabelParamWidget::ClickableLabelParamWidget(std::shared_ptr<AssetParame
QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QString comment = m_model->data(m_index, AssetParameterModel::CommentRole).toString();
setToolTip(comment);
auto *layout = new QVBoxLayout(this);
auto *layout = new QHBoxLayout(this);
QToolButton *tb = new QToolButton(this);
tb->setAutoRaise(true);
tb->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
m_label = new QLabel(this);
m_label->setWordWrap(true);
layout->addWidget(tb);
layout->addWidget(m_label);
setMinimumHeight(m_label->sizeHint().height());
setMinimumHeight(tb->sizeHint().height());
connect(tb, &QToolButton::clicked, [&]() {
QClipboard *clipboard = QApplication::clipboard();
QString value = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
clipboard->setText(value);
});
connect(m_label, &QLabel::linkActivated, [&](const QString &result) {
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(result);
......@@ -63,7 +74,7 @@ void ClickableLabelParamWidget::slotRefresh()
{
QString value = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
m_label->setText(QStringLiteral("<a href=\"%1\">").arg(value) + m_displayName + QStringLiteral("</a>"));
m_label->setVisible(!value.isEmpty());
setVisible(!value.isEmpty());
}
bool ClickableLabelParamWidget::getValue()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment