diff --git a/include/SimpleTextFloat.h b/include/SimpleTextFloat.h index e930d2430..2821ca411 100644 --- a/include/SimpleTextFloat.h +++ b/include/SimpleTextFloat.h @@ -47,7 +47,10 @@ public: void showWithDelay(int msecBeforeDisplay, int msecDisplayTime); - void setVisibilityTimeOut(int msecs); + void showWithTimeout(int msec) + { + showWithDelay(0, msec); + } void moveGlobal(QWidget * w, const QPoint & offset) { diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index ea73e1993..3ef056c43 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -451,14 +451,7 @@ void PianoRoll::showTextFloat(const QString &text, const QPoint &pos, int timeou s_textFloat->setText( text ); // show the float, offset slightly so as to not obscure anything s_textFloat->moveGlobal( this, pos + QPoint(4, 16) ); - if (timeout == -1) - { - s_textFloat->show(); - } - else - { - s_textFloat->setVisibilityTimeOut( timeout ); - } + s_textFloat->showWithTimeout(timeout); } diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 7ce85963b..46f336cb7 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -122,7 +122,7 @@ void Fader::adjustByDecibelDelta(float value) adjustModelByDBDelta(value); updateTextFloat(); - s_textFloat->setVisibilityTimeOut(1000); + s_textFloat->showWithTimeout(1000); } void Fader::adjustByDialog() diff --git a/src/gui/widgets/FloatModelEditorBase.cpp b/src/gui/widgets/FloatModelEditorBase.cpp index 3c7fe93c7..ed09fa261 100644 --- a/src/gui/widgets/FloatModelEditorBase.cpp +++ b/src/gui/widgets/FloatModelEditorBase.cpp @@ -338,7 +338,7 @@ void FloatModelEditorBase::wheelEvent(QWheelEvent * we) s_textFloat->setText(displayValue()); s_textFloat->moveGlobal(this, QPoint(width() + 2, 0)); - s_textFloat->setVisibilityTimeOut(1000); + s_textFloat->showWithTimeout(1000); emit sliderMoved(model()->value()); } diff --git a/src/gui/widgets/SimpleTextFloat.cpp b/src/gui/widgets/SimpleTextFloat.cpp index e37753229..1be683837 100644 --- a/src/gui/widgets/SimpleTextFloat.cpp +++ b/src/gui/widgets/SimpleTextFloat.cpp @@ -62,7 +62,7 @@ void SimpleTextFloat::setText(const QString & text) void SimpleTextFloat::showWithDelay(int msecBeforeDisplay, int msecDisplayTime) { - if (msecBeforeDisplay != 0) + if (msecBeforeDisplay > 0) { m_showTimer->start(msecBeforeDisplay); } @@ -71,7 +71,7 @@ void SimpleTextFloat::showWithDelay(int msecBeforeDisplay, int msecDisplayTime) show(); } - if (msecDisplayTime != 0) + if (msecDisplayTime > 0) { m_hideTimer->start(msecBeforeDisplay + msecDisplayTime); } @@ -84,10 +84,4 @@ void SimpleTextFloat::hide() QWidget::hide(); } -void SimpleTextFloat::setVisibilityTimeOut(int msecs) -{ - QTimer::singleShot(msecs, this, SLOT(hide())); - show(); -} - } // namespace lmms::gui