Results 1 to 5 of 5

Thread: Press one button - emit signal more time

  1. #1
    Join Date
    Oct 2016
    Posts
    61
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Press one button - emit signal more time

    it's possible to use some bolean to avoid press one button all time? For example sometimes i'm doing thing's repetitive for example i'm doing some paint with qt and i want when i press button all time draw. In other words, it is possible to put on one botton pressed all time with some boolean to avoid press many times.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Press one button - emit signal more time

    Do you want to ignore button presses?
    Or disable the button?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2016
    Posts
    61
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Press one button - emit signal more time

    something like when i press the button, the button all time is sending so the slot is openned all time something like said. For example i press one button and draw me circles. But i want when i pressed the button one time the signal is emiting all time so will draw all time circles. I searched in internet and said me call the slot but i think i need to call slot all time. It's like one button is pressed is desactivated, Anyway i'm not sure if i call all time the slot maybe i can repeat these things all time.

  4. #4
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Press one button - emit signal more time

    Make a boolean variable, example: drawCircleChecked, and put a if condition if(drawCircleChecked == true) { paint(); }.
    There is no need for signal / slot mechanism here if I understand correctly.
    Also buttons in Qt can be made checkable, meaning click for check / click for uncheck, so when drawing you can check which button has been checked.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Press one button - emit signal more time

    Quote Originally Posted by SirJonas View Post
    something like when i press the button, the button all time is sending so the slot is openned all time something like said.
    If you want to continuously call a slot, you need a QTimer.
    Your button the simply starts or stops that timer.

    Cheers,
    _

Similar Threads

  1. Seems that my emit doesn't emit the signal
    By roseicollis in forum Newbie
    Replies: 2
    Last Post: 19th January 2015, 17:05
  2. QML manually emit key press signal
    By mushroom in forum Qt Quick
    Replies: 1
    Last Post: 18th August 2011, 18:02
  3. Replies: 2
    Last Post: 1st January 2011, 01:16
  4. Replies: 6
    Last Post: 21st August 2010, 22:09
  5. how to know which button emit the signal?
    By coder1985 in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2008, 15:26

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.