Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change pushbutton icon on pressed?
Forum Updated to NodeBB v4.3 + New Features

How to change pushbutton icon on pressed?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 339 Views 1 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.
  • P Offline
    P Offline
    Pythonic person
    wrote on last edited by Pythonic person
    #1

    Hello, I have a PushButton and I added an icon with no text. now I want to change the icon while the user pressing that button and return to its default after mouse release, how can I achieve that?

    i added the icon by using
    icon = QIcon()
    button.addPixmap(QPixmap("image"))

    am using PYQT5

    Pl45m4P 1 Reply Last reply
    0
    • P Pythonic person

      Hello, I have a PushButton and I added an icon with no text. now I want to change the icon while the user pressing that button and return to its default after mouse release, how can I achieve that?

      i added the icon by using
      icon = QIcon()
      button.addPixmap(QPixmap("image"))

      am using PYQT5

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Pythonic-person

      You can use stylesheet and the pressed indicator/subcontrol

      • https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-the-qpushbutton-s-menu-indicator-sub-control

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      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