QMenu初试

来源:互联网 发布:java防止js注入 编辑:程序博客网 时间:2024/06/01 19:46

      之前学QMenu只知道可以添加QAction,今天通过查看文档,对QMenu有了个大概的认识。

QMenu可以添加的有四种:separators, actions that show a submenu, widgets, and actions that perform an action.

添加的方法主要有三种:addAction(),addActions() and insertAction()

遍历QMenu中QAction的方法:

foreach(QAction* act, menu.actions()){      if (act->menu() != NULL)      {           QMenu* tempMenu = act->menu();           //operating the tempMenu as a QMenu pointer....      }}



原创粉丝点击