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>Set background color for toolButton
Forum Updated to NodeBB v4.3 + New Features

<SOLVED>Set background color for toolButton

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.2k 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.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    Hi
    I am trying to set the background colour for a checkable QToolButton -
    @
    void test2::on_toolButton_clicked()
    {
    if (!ui.toolButton->isChecked())
    {
    ui.toolButton->setStyleSheet("background-color: green");
    }
    else
    {
    ui.toolButton->setStyleSheet("background-color: red");
    }
    }
    @

    First time this gets called the color is solid green
    The next time the color gets set to red, but it not solid, it seems to be cross hatched with white

    Can anyone tell me why this might happen?

    Thanks

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GrahamL
      wrote on last edited by
      #2

      I need to specify border: none

      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