def trigger_menu_item(self, qmenu, action_text, dialog=False):
        ''' trigger a QMenu QAction with action_text. '''

        for iaction, action in enumerate(qmenu.actions()):
            if action.text() == action_text:

                if dialog:
                    def closeDialog():
                        dlg = self.snuffler.activeModalWidget()
                        QTest.keyClick(dlg, Qt.Key_Escape)

                    qc.QTimer.singleShot(150, closeDialog)

                action.trigger()
                break