What’s the best way to go about creating a play/pause button in Qt? Should I create one action and change it’s icon when clicked, or should I create two actions and then somehow hide one when clicked? How do I use one shortcut key to activate both actions? (Pause when playing, or play when paused).
Share
Keep it simple. Use the same button, but when handling the clicking, change the icon and choose the handling logic (play or pause) based on current status (pause when playing or playing when paused).
In order to keep the code clear, implement two separate methods, one for play and one for pause and call them from the slot of the button, depeding on the status.