Bug fix for inverted piano roll vertical slider buttons on Qt GUI.

This commit is contained in:
mjbudd77 2021-11-27 11:09:08 -05:00
parent 82f76e3434
commit 148d6a4af5
2 changed files with 39 additions and 1 deletions

View File

@ -903,10 +903,12 @@ void TasEditorWindow::buildPianoRollDisplay(void)
//pianoRollFrame->setFrameShape( QFrame::StyledPanel );
pianoRollFrame->setFrameShape( QFrame::Box );
pianoRollVBar->setInvertedControls(true);
pianoRollVBar->setInvertedAppearance(true);
pianoRoll->setScrollBars( pianoRollHBar, pianoRollVBar );
connect( pianoRollHBar, SIGNAL(valueChanged(int)), pianoRoll, SLOT(hbarChanged(int)) );
connect( pianoRollVBar, SIGNAL(valueChanged(int)), pianoRoll, SLOT(vbarChanged(int)) );
connect( pianoRollVBar, SIGNAL(actionTriggered(int)), pianoRoll, SLOT(vbarActionTriggered(int)) );
grid->addWidget( pianoRoll , 0, 0 );
grid->addWidget( pianoRollVBar, 0, 1 );
@ -3209,6 +3211,33 @@ void QPianoRoll::hbarChanged(int val)
update();
}
//----------------------------------------------------------------------------
void QPianoRoll::vbarActionTriggered(int act)
{
int val = vbar->value();
if ( act == QAbstractSlider::SliderSingleStepAdd )
{
val = val - 1;
if ( val < 0 )
{
val = 0;
}
vbar->setSliderPosition(val);
}
else if ( act == QAbstractSlider::SliderSingleStepSub )
{
val = val + 1;
if ( val >= maxLineOffset )
{
val = maxLineOffset;
}
vbar->setSliderPosition(val);
}
//printf("ACT:%i\n", act);
}
//----------------------------------------------------------------------------
void QPianoRoll::vbarChanged(int val)
{
lineOffset = maxLineOffset - val;
@ -3413,13 +3442,21 @@ void QPianoRoll::ensureTheLineIsVisible( int lineNum )
{
if ( !lineIsVisible( lineNum ) )
{
int scrollOfs;
lineOffset = lineNum - 3;
if ( lineOffset < 0 )
{
lineOffset = 0;
}
vbar->setValue( lineOffset );
scrollOfs = maxLineOffset - lineOffset;
if ( scrollOfs < 0 )
{
scrollOfs = 0;
}
vbar->setValue( scrollOfs );
update();
}

View File

@ -231,6 +231,7 @@ class QPianoRoll : public QWidget
public slots:
void hbarChanged(int val);
void vbarChanged(int val);
void vbarActionTriggered(int act);
};
class TasEditorWindow : public QDialog