1.设置userdata,并将多个action绑定到同一个slot 
 a->setData(action); //这里的action可以是一个qvariant值

    connect(a, SIGNAL(triggered(bool)),
            this, SLOT(actionslot(bool)));

void actionslot(bool)
{
   QAction *a = qobject_cast<QAction *>(q->sender());
    if (!a)
        return;
    int action =a->data().toInt(); //通过这里来区分是哪个actiontriggered
    //do something your own
}


相关文章:

  • 2021-11-26
  • 2021-12-02
  • 2022-02-08
  • 2022-12-23
  • 2021-06-02
猜你喜欢
  • 2021-07-11
  • 2022-12-23
  • 2021-07-17
  • 2021-10-22
  • 2021-11-18
  • 2021-05-18
相关资源
相似解决方案