Results 1 to 4 of 4

Thread: QLCDNumber

  1. #1
    Join Date
    Sep 2016
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QLCDNumber

    Hi ...I'm looking for a way to make a QLCDNumber component of my project to increment each time a switch connected to the GPIO on a PI is activated . I can do it via an onscreen button in my QT project but the question is how do I do it with a "real world physical" button . Basically I want to count each time the switch is activated and display it with QLCDNumber .Any ideas appreciated on how I can replace the onscreen button with a real button if that makes any sense :-) .

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QLCDNumber

    You have some method in your Pi code that detects when the GPIO pin goes low (or high, depending on what your switch does), right? If not, you'll need to write one, and there are plenty of examples in the Pi programing world on how to do that. (Like this one) When you detect the switch closure, increment a member variable that counts the number of closures, then call QLCDNumber::display().

    Basically, you are replacing the slot that gets called on your GUI button click with similar code that detects the Pi switch closure. In both cases, you do the same thing: increment a counter and update the LDC display.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2016
    Posts
    2
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QLCDNumber

    Thank you so much for your help you are a credit to the community ! ..I'm very new to both QT and Pi things ..I'll work on it with your examples and hopefully get there in the end :-)

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QLCDNumber

    Well, I have my own Pi, still in the box. One day when I have some free time, I will be learning as well.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Editable QLCDNumber
    By QDmitry in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2013, 14:57
  2. Modelling a QLCDNumber in QML
    By lixo1 in forum Qt Quick
    Replies: 1
    Last Post: 24th August 2011, 14:19
  3. QLCDNumber display
    By jhearon in forum Qt Programming
    Replies: 0
    Last Post: 26th October 2008, 23:53
  4. QLCDNumber justify
    By davisjamesf in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2007, 10:02
  5. QLabel and QLCDNumber
    By mickey in forum Newbie
    Replies: 5
    Last Post: 17th March 2006, 08:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.