Hide icon I had previously given to a QPushButton

  • I am creating a virtual keyboard and it works. Within the keyboard I created a button where if you click it, it will take you the number/symbols keyboard. When that button is clicked, the caps lock button, which is an icon, it will turn into an apostrophe symbol. However, the icon doesn't hide/disappear and it is next to the apostrophe. Is there any way to hide the icon temporarily?

  • Moderators

    You can't hide it temporarily but you can just remove it by setting a null icon (button->setIcon(QIcon())) and switch it back when you need to.

    Also, if that's an option for you, you can switch to QToolButton which has a toolButtonStyle property that you can set to show text, icon or both.

Log in to reply