X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdoubleparameterwidget.cpp;h=3f4838c5fa9d7024081229832ce7c7128a5a2619;hb=29ceabd2afc227e0fb8b586c567eeaf7921b542e;hp=0925ce2228b8b921f88e9c1835f7b9544551d56c;hpb=23803a2984c48c67414440ac078ae0e43b4ceec3;p=kdenlive diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index 0925ce22..3f4838c5 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -26,37 +26,34 @@ #include #include +#include #include #include -DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, int id, const QString suffix, QWidget *parent) : - QWidget(parent), - m_commentLabel(NULL) +DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, double min, double max, double defaultValue, const QString &comment, int id, const QString &suffix, int decimals, QWidget *parent) + : QWidget(parent), + m_commentLabel(NULL) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); QGridLayout *layout = new QGridLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); - m_dragVal = new DragValue(name, defaultValue, 0, id, suffix, this); - m_dragVal->setRange(min, max); - m_dragVal->setPrecision(0); + m_dragVal = new DragValue(name, defaultValue, decimals, min, max, id, suffix, this); layout->addWidget(m_dragVal, 0, 1); if (!comment.isEmpty()) { - m_commentLabel = new QLabel(comment, this); - m_commentLabel->setWordWrap(true); - m_commentLabel->setTextFormat(Qt::RichText); - m_commentLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); - m_commentLabel->setFrameShape(QFrame::StyledPanel); - m_commentLabel->setFrameShadow(QFrame::Raised); - m_commentLabel->setHidden(true); - layout->addWidget(m_commentLabel, 1, 0, 1, -1); + setToolTip(comment); } - connect(m_dragVal, SIGNAL(valueChanged(int, bool)), this, SLOT(slotSetValue(int, bool))); + m_dragVal->setValue(value, false); + connect(m_dragVal, SIGNAL(valueChanged(double,bool)), this, SLOT(slotSetValue(double,bool))); connect(m_dragVal, SIGNAL(inTimeline(int)), this, SIGNAL(setInTimeline(int))); - m_dragVal->setValue(value); +} + +DoubleParameterWidget::~DoubleParameterWidget() +{ + delete m_dragVal; } int DoubleParameterWidget::spinSize() @@ -69,22 +66,21 @@ void DoubleParameterWidget::setSpinSize(int width) m_dragVal->setSpinSize(width); } -void DoubleParameterWidget::setValue(int value) +void DoubleParameterWidget::setValue(double value) { m_dragVal->blockSignals(true); m_dragVal->setValue(value); m_dragVal->blockSignals(false); - //emit valueChanged(value); } -void DoubleParameterWidget::slotSetValue(int value, bool final) +void DoubleParameterWidget::slotSetValue(double value, bool final) { if (final) { emit valueChanged(value); } } -int DoubleParameterWidget::getValue() +double DoubleParameterWidget::getValue() { return m_dragVal->value(); } @@ -101,13 +97,7 @@ void DoubleParameterWidget::setInTimelineProperty(bool intimeline) void DoubleParameterWidget::slotShowComment( bool show) { - if (m_commentLabel) { - m_commentLabel->setVisible(show); - if (show) - layout()->setContentsMargins(0, 0, 0, 15); - else - layout()->setContentsMargins(0, 0, 0, 0); - } + Q_UNUSED(show) } #include "doubleparameterwidget.moc"