c++ - Problem with QSignalMapper and QAction never triger the Slot -



c++ - Problem with QSignalMapper and QAction never triger the Slot -

hi seek bind slot argument qaction triggered signal have code ,the context menu working great . openpublishwin never triggered .

void myapp::showcontextmenu(const qpoint& pos) // slot { qstring groupid; qpoint globalpos = ui.treeview_mainwindow->maptoglobal(pos); qmodelindex modelindx = ui.treeview_mainwindow->indexat(pos); groupid = modelindx.model()->index(modelindx.row(),0,modelindx.parent()).data(qt::userrole).tostring(); qmenu mymenu; openpublishaction = new qaction(tr("send"), this); mymenu.addaction(openpublishaction); connect(openpublishaction, signal(triggered()),m_signalmapper, slot(map()) ); m_signalmapper->setmapping(openpublishaction,groupid); connect(m_signalmapper, signal(mapped(qstring)), this, slot(openpublishwin(qstring))); qaction* selecteditem = mymenu.exec(globalpos); } void myapp::openpublishwin(qstring gid) { writelog(gid) }

a quick @ qt docs qsignalmapper (assuming you're using based on question title) states parameter mapped signal const qstring&. can't recall if parameter needs exact in case connection may factor.

additionally, double check connects beingness made wrapping them in assert or form of verify. qt print out console if connection cannot made.

c++ qt

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -