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. Light up a button when the button is clicked

Light up a button when the button is clicked

Scheduled Pinned Locked Moved Solved General and Desktop
button
4 Posts 3 Posters 1.9k 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.
  • J Offline
    J Offline
    jkprog
    wrote on 31 May 2017, 19:52 last edited by
    #1

    Hi, I am trying to control some pins on arduino using QT gui. My requirement is to have one button for each pin. In order to turn on the pin, I click the button and the button should light up and stay pressed, and when i click the button again it should be back to its default state, that is, no light and it should be released.
    Is there a way to do this? Can anyone please guide me through the steps that I will need to follow?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 31 May 2017, 21:48 last edited by
      #2

      Hi,

      Sounds like a QPushButton with the checkable property set to true.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • E Offline
        E Offline
        Eddy
        wrote on 1 Jun 2017, 08:03 last edited by Eddy 6 Jan 2017, 08:03
        #3

        To add to @SGaist , you can use a stylesheet to make the checked state more visible.

        Have a look at the qpushbutton stylesheet example

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        2
        • J Offline
          J Offline
          jkprog
          wrote on 6 Jun 2017, 19:54 last edited by
          #4

          yeah I used the stylesheets and it solved my problem

          1 Reply Last reply
          1

          3/4

          1 Jun 2017, 08:03

          • Login

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