From: D. M. M. <ros...@gm...> - 2013-09-03 11:28:00
|
This ended up off-list. I'm forwarding it back to the list and adding: I leave it to you as an exercise to figure out how to solve: Mouse wheeling over the combo box makes m_vibratoBox show and hide itself like you wanted, but when this widget is hidden, the layout gets all stretched out, and more importantly, the combo box is no longer sitting under the mouse cursor, so you can't roll through smoothly. There's some way to fix that with spacers, stretch, strut, or some combination thereof, and I have honestly just never been worth a damn with any of that stuff. I dicked around with it for a bit, but I'm giving up, and leaving it to you to figure out. Or not, as you prefer. Since it's harder to see the patches now, I'm going to paste a copy for your perusal: Index: src/gui/dialogs/PitchBendSequenceDialog.cpp =================================================================== --- src/gui/dialogs/PitchBendSequenceDialog.cpp (revision 13392) +++ src/gui/dialogs/PitchBendSequenceDialog.cpp (working copy) @@ -231,7 +231,7 @@ (whatVaries == Pitch) ? tr("Vibrato") : (whatVaries == Volume) ? tr("Tremolo") : tr("LFO"); - QGroupBox *m_vibratoBox = new QGroupBox(vibratoBoxText); + m_vibratoBox = new QGroupBox(vibratoBoxText); m_vibratoBox-> setToolTip(tr("<qt>Low-frequency oscillation for this controller. This is only possible when Ramp mode is linear and <i>Use this many steps</i> is set.</qt>")); m_vibratoBox->setContentsMargins(5, 5, 5, 5); @@ -351,8 +351,8 @@ slotSequencePresetChanged(m_sequencePreset->currentIndex()); - slotStepSizeStyleChanged(true); - maybeEnableVibratoFields(); + // the above called slotStepSizeStyleChanged() which called + // maybeEnableVibratoFields() m_radioReplace->setChecked(true); connect(m_sequencePreset, SIGNAL(activated(int)), this, @@ -413,7 +413,7 @@ m_vibratoFrequency->setEnabled(false); } else { slotStepSizeStyleChanged(true); - maybeEnableVibratoFields(); + //maybeEnableVibratoFields(); } } @@ -424,10 +424,7 @@ m_radioRampLinear->isChecked() && m_radioStepSizeByCount->isChecked(); - m_vibratoStartAmplitude->setEnabled(enable); - m_vibratoEndAmplitude->setEnabled(enable); - m_vibratoFrequency->setEnabled(enable); - // show()/hide() on m_vibratoBox is buggy so we don't use it. + m_vibratoBox->setVisible(enable); } void @@ -495,7 +492,7 @@ } } slotStepSizeStyleChanged(true); - maybeEnableVibratoFields(); + // the above called maybeEnableVibratoFields(); } bool -------- Original Message -------- Subject: Re: [Rosegarden-devel] Fixed Qt warnings on PitchBendDialogSequence Date: Tue, 03 Sep 2013 07:05:13 -0400 From: D. Michael McIntyre <ros...@gm...> To: Tom Breton (Tehom) <te...@pa...> > // show()/hide() on m_vibratoBox is buggy so we don't use it. > if(!enable) > { m_vibratoBox->hide(enable); } Bang! I looked at it over a dozen times before I saw the problem, but now I'm sure I know why this is taking a crap. It's super easy to do this in Qt: foo.h: QThingie *m_myThingie; foo.cpp: ctor { QThingie *m_myThingie = new QThingie(); } Foo::memberFunction() { m_myThingie->doSomething(); } The call to m_myThingie->doSomething() goes KABLOOEY!!! because m_myThingie within the ctor is a local variable, and m_myThingie accessed from any member function is a null pointer. Do you see the dumb dumb now? It should have been: m_myThingie = new QThingie(); Congratulations, I think you just joined a club or something. I remember having this conversation with Guillaume Laurent after I had made the same stupid mistake when I first started out, and then I remember Chris Cannam finding my having made the same error again much later. It's easy to do. I'll clean up the mess and commit this fix. Haven't compiled it yet, but I bet you $1 it will solve the problem. -- D. Michael McIntyre |
From: Tom B. (Tehom) <te...@pa...> - 2013-09-03 15:55:13
|
> This ended up off-list. I'm forwarding it back to the list and adding: > > I leave it to you as an exercise to figure out how to solve: OK. I see the problem. I can probably at least make it work reasonably. Wrt "QThingie *m_myThingie = new QThingie();", towards preventing it from happening yet again. I grepped thru the code and didn't find any further mis-declarations of members. This seems like the sort of thing cppcheck might help us with, if it wasn't reporting thousands of warnings already. Tom Breton (Tehom) |
From: Tom B. (Tehom) <te...@pa...> - 2013-09-03 16:48:05
|
>> This ended up off-list. I'm forwarding it back to the list and adding: >> >> I leave it to you as an exercise to figure out how to solve: > > OK. I see the problem. I can probably at least make it work reasonably. Update: It's half-fixed. The easy part, of course. Once we have displayed the vibratobox once, the preset field stays in place for the life of the dialog. Tom Breton (Tehom) |