Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to set icon at different modes?
Forum Updated to NodeBB v4.3 + New Features

How to set icon at different modes?

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 3 Posters 5.0k 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.
  • M Offline
    M Offline
    Matze5590
    wrote on 24 Sept 2010, 08:18 last edited by
    #1

    Hi,

    I try to change the image of a qpushbutton in disabled mode
    This is just editing the Normal mode.
    @
    setIcon(QIcon(":/images/image.bmp"));
    @

    Thanks

    [edit:syntax hihlight added / Denis Kormalev]

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on 24 Sept 2010, 09:03 last edited by
      #2

      You should create QIcon object and set additional pixmap for QIcon::Mode==Disabled

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cheng
        wrote on 24 Sept 2010, 15:14 last edited by
        #3

        You can use style sheet:
        @
        QPushButton {
        border-image: url(:/images/bouton-retour.png);
        background-color: rgba(255, 255, 255, 0);
        }

        QPushButton::pressed,QPushButton:disabled {
        border-image: url(:/images/bouton-retour-desactive.png);
        }
        @

        [edit: fixed code / chetankjain]

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on 24 Sept 2010, 18:44 last edited by
          #4

          cheng, border-image is not exactly what needed for author. It will fill borders, but not change icon.

          1 Reply Last reply
          0

          1/4

          24 Sept 2010, 08:18

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved