I've a button with menus like so:
Qt Code:
  1. pButton2 = new QPushButton(tr("&Terrain"));
  2. menu = new QMenu(this);
  3. action1 = menu->addAction(tr("Topography"));
  4. action2 = menu->addAction(tr("Landsat"));
  5. pButton2->setMenu(menu);
  6.  
  7. connect(action1, SIGNAL(triggered()), this, SLOT(mySlot(1))); //wrong
  8. connect(action2, SIGNAL(triggered()), this, SLOT(mySlot(2)));
To copy to clipboard, switch view to plain text mode 

I know why this doesn't work: triggered() has no parameters, mySlot(int) has one. I could fix this by making 2 separate mySlot() functions that don't take parameters, but I'm going to have alot of these and was wondering if there's another, better way to do it... a way such that I can create a single SLOT function.