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. Focus and Change in Icon
Forum Updated to NodeBB v4.3 + New Features

Focus and Change in Icon

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 2.3k 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.
  • R Offline
    R Offline
    Revu
    wrote on last edited by
    #1

    How do I change the Icon of QPushButton when it has focus and also when it doesn't have?I had tried with hasFocus() to change the Icon but again I need to reset it by calling another function.Mainly I need to change the Icon when I change the focus with arrow keys in the keyboard.

    Every fall is to raise higher than Before.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Try something like this:

      @
      navButton->setStyleSheet("QPushButton { background-color:red; } QPushButton:focus { background-color:blue; }");
      @

      The code snippet is from "stackoverflow":http://stackoverflow.com/questions/1531062/how-to-change-a-qpushbutton-icon-when-it-has-focus because a common task was discussed there too.

      Of course instead of changing just the background color you can modify the code snippet to change the icon of your button.

      http://anavi.org/

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Revu
        wrote on last edited by
        #3

        HI thank You..I had tried it but of no use.On focus it doesnot work.I had used QtCreator for designing my forms.There I had used different icons for various states like Normal,Selected,Disabled but it doesn't work.

        Every fall is to raise higher than Before.

        1 Reply Last reply
        0

        • Login

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