- We use a message box to tell users that they are already viewing the first or last image as they attempt to view the image prior to the first image, or the image following the last image. However, there is another way to handle this: disable prevAction when users are viewing the first image, and disable nextAction when users are viewing the last image. How do we go about this?
The QAction class has a bool enabled property and, hence, a setEnabled(bool) method, and we call it to enable or disable the corresponding action in the prevImage and nextImage methods.
- There is only text on our menu items or tool buttons. How can we add an icon image to them?
The QAction class has a QIcon icon property and, hence, a setIcon method, and you can create and set an icon for the action. To create a QIcon object, please refer to its corresponding documentation...