MarkoSan
30th May 2007, 07:48
Hi to all!
I am developing an application that will have a lot of menus. Now, I've prepared following code snippet:
m_pDataSourceAction=new QAction(tr("&Data source ..."), this);
Q_CHECK_PTR(m_pDataSourceAction);
m_pDataSourceAction->setShortcut(tr("Ctrl+D"));
m_pDataSourceAction->setStatusTip(tr("Selects data source"));
connect(m_pDataSourceAction, SIGNAL(triggered()), this, SLOT(dataSourceSelection()));
How do I transform this code snipper into an flexible method - method with paramateres ActionText, ShortcutCombo, StatusTipText, SourceSignal, TargetSlot. Now, method should return pointer to QAction, I am aware of that. But how do I declare signal and slot as a parameter of method?
I am developing an application that will have a lot of menus. Now, I've prepared following code snippet:
m_pDataSourceAction=new QAction(tr("&Data source ..."), this);
Q_CHECK_PTR(m_pDataSourceAction);
m_pDataSourceAction->setShortcut(tr("Ctrl+D"));
m_pDataSourceAction->setStatusTip(tr("Selects data source"));
connect(m_pDataSourceAction, SIGNAL(triggered()), this, SLOT(dataSourceSelection()));
How do I transform this code snipper into an flexible method - method with paramateres ActionText, ShortcutCombo, StatusTipText, SourceSignal, TargetSlot. Now, method should return pointer to QAction, I am aware of that. But how do I declare signal and slot as a parameter of method?