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. How to create/edit slot to change a widget's color
Qt 6.11 is out! See what's new in the release blog

How to create/edit slot to change a widget's color

Scheduled Pinned Locked Moved General and Desktop
slotscolor change
1 Posts 1 Posters 1.1k 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.
  • T Offline
    T Offline
    thestarsatnight
    wrote on last edited by
    #1

    I am trying to change some formatting in QT based on some values changing. I am using some epicsQT widgets which read some values off instruments (humidity is one example). I want the color of a button to change (and flash, if possible) to change if the value exceeds some limit (let's say 85 percent for humidity).

    Is there a signal/slot combination to use? I've tried the update() slot, and tried to model the painterEvent that's covered in the analogClock example. But I don't think what I want to do is an "event." Aren't events different than signals?

    For testing, I've been trying with just a simple spinBox, and a qanalogSlider to try to get the MainWindow to change color. I just want the color to change (and possibly flash) if the value goes over something arbitrary (say greater than 5).

    I think I understand how to basically add custom slots, if there's not one ready to do what I want, but I can't seem to get my little test to change any colors.

    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