C++/QT: "run" a QAction -


i need automate gui test using qt,c++,qtest (in eclipse) have dynamically created menu dynamically created qactions, need test "new tab" qaction (inside menu), how created:

  m_pnewtabaction = new qaction(qicon(":/images/add.png"), tr("&new tab"), this);   m_pnewtabaction->setshortcut(tr("ctrl+n"));   m_pnewtabaction->setstatustip(tr("open new tab"));   connect(m_pnewtabaction, signal(triggered()), this, slot(newtab())); 

in testclass, managed access private qaction object (m_pnewtabaction) using "findchildren" function, dont know how can "execute" qaction (or in other words "add new tab") testclass:

    //get actions available filemenu     qlist<qaction *> fileactions = filemenu->findchildren<qaction *>();     //execute action??     fileactions.front()-> //how execute qaction? 

i believe you're looking qaction::activate():

void qaction::activate(actionevent event) 

actionevent 1 of qaction::trigger or qaction::hover. want qaction::trigger.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -