@@ -46,14 +46,24 @@ void EFXItem::calculateWidth()
46
46
{
47
47
int newWidth = 0 ;
48
48
qint64 efxDuration = getDuration ();
49
+ float timeUnit = 50.0 / float (getTimeScale ());
49
50
50
- if (efxDuration != 0 )
51
- newWidth = ((50.0 / float (getTimeScale ())) * float (efxDuration)) / 1000.0 ;
52
- else
51
+ if (efxDuration == 0 )
52
+ {
53
53
newWidth = 100 ;
54
+ }
55
+ else if (efxDuration == Function::infiniteSpeed ())
56
+ {
57
+ newWidth = timeUnit * 10000 ;
58
+ }
59
+ else
60
+ {
61
+ newWidth = (timeUnit * float (efxDuration)) / 1000.0 ;
62
+ }
63
+
64
+ if (newWidth < timeUnit)
65
+ newWidth = timeUnit;
54
66
55
- if (newWidth < (50 / m_timeScale))
56
- newWidth = 50 / m_timeScale;
57
67
setWidth (newWidth);
58
68
}
59
69
@@ -63,14 +73,19 @@ void EFXItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
63
73
Q_UNUSED (widget);
64
74
65
75
float xpos = 0 ;
66
- float timeScale = 50 / float (m_timeScale );
76
+ float timeUnit = 50.0 / float (getTimeScale () );
67
77
68
78
ShowItem::paint (painter, option, widget);
69
79
70
- int loopCount = m_function->duration () ? qFloor (m_function->duration () / m_efx->duration ()) : 0 ;
80
+ int loopCount = 0 ;
81
+ if (getDuration () == Function::infiniteSpeed ())
82
+ loopCount = 10000 / m_efx->duration ();
83
+ else if (getDuration () > 0 )
84
+ loopCount = qFloor (getDuration () / m_efx->duration ());
85
+
71
86
for (int i = 0 ; i < loopCount; i++)
72
87
{
73
- xpos += ((timeScale * float (m_efx->duration ())) / 1000 );
88
+ xpos += ((timeUnit * float (m_efx->duration ())) / 1000 );
74
89
// draw loop vertical delimiter
75
90
painter->setPen (QPen (Qt::white, 1 ));
76
91
painter->drawLine (int (xpos), 1 , int (xpos), TRACK_HEIGHT - 5 );
0 commit comments