QTreeWidget signal not working
Hi...
There is a small problem in it.. whenever i double click on any of my QTreeWIdgetItem, it does not do anything.. infact does not respond to it..
HAve followed all the conventions...
like declaring func in slots and calling the Q_OBJECT...
also i tried to put the arguments as that of signals and slots as same but still it did not work..
i am posting the few lines of code whcih are not wrkin... plz tell what can be the fault in it.. it even does not show me any errors while compiling.. its just that it doesnt work...
Code:
QList<QTreeWidgetItem
*> widgetList
= m_uiMainWindow.
routingFlowTree->findItems
(QString("Add Design"),Qt
::MatchRecursive);
if(widgetList.size() != 0)
{
QObject::connect(m_uiMainWindow.
routingFlowTree,
SIGNAL(itemDoubleClicked
(*pAddDesignItem ,
0)),
this,
SLOT(onDoubleClickAddDesignItem
()));
}
Thanking you,
with regards,
Kapil
Re: QTreeWidget signal not working
You may NOT add parameter names or values in SIGNAL and SLOT macros.
Quote:
SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int))
Re: QTreeWidget signal not working
Hi...
Thanks for the reply,
i want the signal to be emitted when a particular sub item of the QTreeWidget is double clicked.. if i do not add the parameter names then it executes the same slot for any of the items clicked on the Tree Widget .. i want different slots to be executed for different tree widget items clicked...
what do i do for that....
what i tried didnt work...
with regards ,
Kapil
Re: QTreeWidget signal not working
Use connect for conecting needed item with needed slot
Re: QTreeWidget signal not working
Quote:
Originally Posted by zlatko
Use connect for conecting needed item with needed slot
Hi..
am doing that only.. just check on the small code which i have put.. this would give u some idea...
Re: QTreeWidget signal not working
Code:
// connection
connect(m_uiMainWindow.
routingFlowTree,
SIGNAL(itemDoubleClicked
(QTreeWidgetItem*,
int)),
this,
SLOT(onDoubleClickAddDesignItem
(QTreeWidgetItem*,
int)));
// slot
void Something
::onDoubleClickAddDesignItem(QTreeWidgetItem* item,
int column
) {
QList<QTreeWidgetItem
*> widgetList
= m_uiMainWindow.
routingFlowTree->findItems
(QString("Add Design"),Qt
::MatchRecursive);
if (widgetList.size() > 0 && item == widgetList.takeFirst())
{
// do your thing
}
}
Re: QTreeWidget signal not working
Hi..
Thanks a lot for the code block.. It solves the problem... I was trying to put on this idea that ur answer came..
Thanks again...
with regards..
Kapil