Fix TextFloat flickering (#7942)

Fixes TextFloat flickering which occurs when scrolling on knobs, faders, and note volume in the piano roll.

---------

Co-authored-by: Dalton Messmer <messmer.dalton@gmail.com>
This commit is contained in:
Alex
2025-06-11 01:04:45 +02:00
committed by GitHub
parent 53d30d8b91
commit a505f570e9
5 changed files with 9 additions and 19 deletions

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -122,7 +122,7 @@ void Fader::adjustByDecibelDelta(float value)
adjustModelByDBDelta(value);
updateTextFloat();
s_textFloat->setVisibilityTimeOut(1000);
s_textFloat->showWithTimeout(1000);
}
void Fader::adjustByDialog()

View File

@@ -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());
}

View File

@@ -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