X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdoubleparameterwidget.cpp;h=ce8153a5074512f43c9e19eda11560288df873e2;hb=7ac877ea57663a02e9042939aa51eb700fbe4301;hp=342fe5f791b066ca3e3380f83e74c9a297ba8bd7;hpb=4359bf84c589b4cdd98c4591b1571fd8366cb112;p=kdenlive diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index 342fe5f7..ce8153a5 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -31,9 +31,8 @@ #include -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) +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) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); QGridLayout *layout = new QGridLayout(this); @@ -44,20 +43,18 @@ DoubleParameterWidget::DoubleParameterWidget(const QString &name, double value, 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); } - m_dragVal->setValue(value); - 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))); } +DoubleParameterWidget::~DoubleParameterWidget() +{ + delete m_dragVal; +} + int DoubleParameterWidget::spinSize() { return m_dragVal->spinSize(); @@ -68,21 +65,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); } -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(); } @@ -99,13 +96,6 @@ 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); - } } #include "doubleparameterwidget.moc"