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. [Solved] Qt pushButtons background-color
QtWS25 Last Chance

[Solved] Qt pushButtons background-color

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.3k Views
  • 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.
  • X Offline
    X Offline
    xXDarkShadowXx
    wrote on last edited by
    #1

    The way my program works is, when a button is pressed, it hide() the pressed button, change my Dialog's background-image and show() a previously hidden button.

    The problem is, whenever i show() a button, the button's background-color becomes transparent and a colored border shows up.

    Why is that? Thanks

    Here's an animated image of my problem.

    "http://postimg.org/image/mi6tdx3lv/":http://postimg.org/image/mi6tdx3lv/

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i assume you use stylesheets? If so please post it.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xXDarkShadowXx
        wrote on last edited by
        #3

        [quote author="raven-worx" date="1381232373"]i assume you use stylesheets? If so please post it.[/quote]

        That's all my button stylesheets uses : background-color: red;

        Here's the rest of the code.

        @void NetstatMap::on_HomeButton_clicked(){
        setStyleSheet("background-image: url(:/mapom.png)");

        ui->HomeButton->hide();
        ui->backButton->show();
        

        }

        void NetstatMap::on_backButton_clicked(){
        setStyleSheet("background-image: url(:/map.png)");

        ui->backButton->hide();
        ui->HomeButton->show();
        

        }
        @

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          setting it this way will set it also for all child widgets.
          Maybe this is what you want:
          @
          setStyleSheet("NetstatMap { background-image: url(:/map.png); }");
          @

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xXDarkShadowXx
            wrote on last edited by
            #5

            [quote author="raven-worx" date="1381232611"]setting it this way will set it also for all child widgets.
            Maybe this is what you want:
            @
            setStyleSheet("NetstatMap { background-image: url(:/map.png); }");
            @[/quote]

            It worked, thanks!

            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