// create a new QAction object QAction *myAction = new QAction(this); // set the objectName property myAction->setObjectName("myAction");
// find the QAction object with the objectName "myAction" QAction *foundAction = this->findChildThese examples show how the objectName property can be used to easily reference QAction objects in a Qt application. The Qt library contains the QAction class and related classes for creating GUI applications.("myAction"); // check if the QAction exists if(foundAction != nullptr) { // do something with the QAction object foundAction->setEnabled(false); }