summaryrefslogtreecommitdiff
path: root/muse2/muse/instruments
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-12-14 01:11:01 +0000
committerTim E. Real <termtech@rogers.com>2010-12-14 01:11:01 +0000
commit522ca271bfb851789aa437a5b88f980cb96916b2 (patch)
treeb418f5dff1bdac80694f660ad81389e3f0853881 /muse2/muse/instruments
parent466a93203ef2cccbf91316e28661aaa29f8a506e (diff)
Please see ChangeLog.
Diffstat (limited to 'muse2/muse/instruments')
-rw-r--r--muse2/muse/instruments/editinstrument.cpp21
-rw-r--r--muse2/muse/instruments/editinstrument.h2
2 files changed, 17 insertions, 6 deletions
diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp
index 2fa1f0c9..a0aba89c 100644
--- a/muse2/muse/instruments/editinstrument.cpp
+++ b/muse2/muse/instruments/editinstrument.cpp
@@ -48,7 +48,7 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl)
toolBar->addAction(QWhatsThis::createAction(this));
Help->addAction(QWhatsThis::createAction(this));
- patchpopup = new QMenu(patchButton);
+ ///patchpopup = new QMenu(patchButton);
//patchpopup->setCheckable(false);// Qt4 doc says this is unnecessary.
// populate instrument list
@@ -1435,14 +1435,16 @@ void EditInstrument::patchButtonClicked()
//int port = track->outPort();
//MidiInstrument* instr = midiPorts[port].instrument();
- patchpopup->clear();
+ //patchpopup->clear();
+ QMenu* patchpopup = new QMenu;
+
PatchGroupList* pg = workingInstrument.groups();
if (pg->size() > 1) {
for (ciPatchGroup i = pg->begin(); i != pg->end(); ++i) {
PatchGroup* pgp = *i;
- QMenu* pm = new QMenu(pgp->name);
+ QMenu* pm = patchpopup->addMenu(pgp->name);
//pm->setCheckable(false);//Qt4 doc says this is unnecessary
pm->setFont(config.fonts[0]);
const PatchList& pl = pgp->patches;
@@ -1460,7 +1462,6 @@ void EditInstrument::patchButtonClicked()
// }
}
- patchpopup->addMenu(pm);
}
}
else if (pg->size() == 1 ){
@@ -1478,10 +1479,20 @@ void EditInstrument::patchButtonClicked()
}
if(patchpopup->actions().count() == 0)
+ {
+ delete patchpopup;
return;
-
+ }
+
QAction* act = patchpopup->exec(patchButton->mapToGlobal(QPoint(10,5)));
+ if(!act)
+ {
+ delete patchpopup;
+ return;
+ }
+
int rv = act->data().toInt();
+ delete patchpopup;
if (rv != -1)
{
diff --git a/muse2/muse/instruments/editinstrument.h b/muse2/muse/instruments/editinstrument.h
index b200e326..62ad389e 100644
--- a/muse2/muse/instruments/editinstrument.h
+++ b/muse2/muse/instruments/editinstrument.h
@@ -44,7 +44,7 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase {
void setDefaultPatchControls(int);
const char* getPatchName(int);
void deleteInstrument(QListWidgetItem*);
- QMenu* patchpopup;
+ ///QMenu* patchpopup;
private slots:
virtual void fileNew();