How to execute QList "action" ?
-
I have a verified / valid QList of actions.
How do I code to execute specific action ?pTEST "childAt" is not an IteliSense option
parent->childAt is asking for x, y values
QList <QObject *> pTEST = parent->children();
Locals index 1 int pTEST <35 items> QList<QObject*> [0] "_layout" QMainWindowLayout [1] "SettingsDialog" SettingsDialog [2] @0x555555cdf3d0 QSerialPort [3] "actionAbout" QAction [4] "actionAboutQt" QAction [5] "actionConnect" QAction [6] "actionDisconnect" QAction [7] "actionConfigure" QAction [8] "actionClear" QAction [9] "actionQuit" QAction [10] "actionVirtual_serial_port" QAction [11] "actionBluetooth_virtual_port" QAction [12] "actionBluetooth" QAction [13] "actionBluetooith_virtiual_port" QAction [14] "actionBluetooth_service_enable" QAction [15] "actionWinsow_control" QAction [16] "actionWindoiw_control" QAction [17] "actionTEST_tile" QAction [18] "actionTEST_resize" QAction [19] "actionTile_subwindows" QAction [20] "actionCascade_subwindows" QAction [21] "actionMaximize_current_subwindow" QAction [22] "actionTEST" QAction [23] "actionSubmenu_1" QAction [24] "actionSubmenuy_2" QAction [25] "actionClear_all_windoiws" QAction [26] "actionClear_all_windiws" QAction [27] "actionSerial_test" QAction [28] "actionSerial_test_2" QAction [29] "actionC_code_scan" QAction [30] "actionSelect_MDI_subwindow_MDI_window_control" QAction [31] "menuBar" QMenuBar [32] "mainToolBar" QToolBar [33] "statusBar" QStatusBar [34] @0x555555c55820 QMdiArea pTEST_Action <0 items> QList<QAction*> parent "MainWindow_Bluetooth" MainWindow_Bluetooth test " TEST SettingsDialog Constructor (emit index 1 ) " QString this "SettingsDialog" SettingsDialog Inspector Expressions "(?<=\thci0 <no such value> // subMenu[index] = subMenu[index] // ->addMenu(list[index] + SERIAL_SETUP SetupRun endif // //subtempmenu = new QMenu(); // m_ui->actionConnect Return Value Tooltip QList <no such value>
-
I have a verified / valid QList of actions.
No, you haven't.
The given List holdsQObject
pointers, not actions. It's aQObjectList
.
Most of the content items areQAction
pointers, but not all of them. Its consistency as a list of actions has neither been properly verified, nor validated.I am not entirely sure, what you mean by "execute". An action can't be executed, it has no
exec()
slot.
It can be triggered, by callingQAction::trigger()
, in which case it emits it'striggered()
signal. If a slot is connected to that signal, the slot will be called.This is how to obtain a list of
QAction
children, and trigger all of them:const auto actionList = pTEST->findChildren<QAction *>(); for (auto *action : actionList) action->trigger();
-
Dear @AnneRanch,
you are not supposed to simply delete posts, if they have become irrelevant and/or solved.
The rules in this forum are to mark them solved, when they are.
This is because they are likely to be a reference for others with similar issues.