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. (Solved)How to disable the background-image in runtime?
Forum Updated to NodeBB v4.3 + New Features

(Solved)How to disable the background-image in runtime?

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 4 Posters 6.6k 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.
  • H Offline
    H Offline
    hisong1988
    wrote on last edited by
    #1

    Hello, everyone.

    Now I face the problem.
    I set a default image as the background-image of a QToolbutton by using setStyleSheet funtion;
    @
    toolButton->setStyleSheet("background-image:url(:/gfx/sy_101.png)");
    @

    Now I want to the "turn off " the image when I click the button. what should I do?

    any suggestions?

    best regards.
    hisong

    I am still searching for....

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kamalakshantv
      wrote on last edited by
      #2

      It seems you want to change the background on focus. You can try something like

      @toolButton->setStyleSheet("focus { background:yellow; }");@

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vsorokin
        wrote on last edited by
        #3

        QtK, Yellow is good idea, if only toolbuttons is ywllow :)
        I think it looks so:
        @toolButton->setStyleSheet("focus { background-mage:none; }");@

        --
        Vasiliy

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          you could do that in one style sheet, then always on click (or focus) the background image is away.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hisong1988
            wrote on last edited by
            #5

            Thanks all men above.

            It seems that the code below is the switch of the background-image.
            @
            toolButton->setStyleSheet("focus { background-mage:none; }");
            @

            I had solved the problem.

            I am still searching for....

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kamalakshantv
              wrote on last edited by
              #6

              [quote author="Vass" date="1292970873"]QtK, Yellow is good idea, if only toolbuttons is ywllow :)
              I think it looks so:
              @toolButton->setStyleSheet("focus { background-mage:none; }");@[/quote]

              I just wanted to illustrate how to use it. Didn't exactly mean to use yellow color. :)

              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