Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. How to execute QList "action" ?
Forum Updated to NodeBB v4.3 + New Features

How to execute QList "action" ?

Scheduled Pinned Locked Moved Unsolved C++ Gurus
3 Posts 2 Posters 441 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    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>	 
    
    
    Axel SpoerlA 1 Reply Last reply
    0
    • A Anonymous_Banned275

      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>	 
      
      
      Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      I have a verified / valid QList of actions.

      No, you haven't.
      The given List holds QObjectpointers, not actions. It's a QObjectList.
      Most of the content items are QAction 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 calling QAction::trigger(), in which case it emits it's triggered()signal. If a slot is connected to that signal, the slot will be called.

      This is how to obtain a list of QActionchildren, and trigger all of them:

      const auto actionList = pTEST->findChildren<QAction *>();
      for (auto *action : actionList)
           action->trigger();
      

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      1
      • Axel SpoerlA Offline
        Axel SpoerlA Offline
        Axel Spoerl
        Moderators
        wrote on last edited by
        #3

        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.

        Software Engineer
        The Qt Company, Oslo

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved