Results 1 to 5 of 5

Thread: Press one button - emit signal more time

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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.

  2. #2
    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.

  3. #3
    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, 16:05
  2. QML manually emit key press signal
    By mushroom in forum Qt Quick
    Replies: 1
    Last Post: 18th August 2011, 17:02
  3. Replies: 2
    Last Post: 1st January 2011, 00:16
  4. Replies: 6
    Last Post: 21st August 2010, 21:09
  5. how to know which button emit the signal?
    By coder1985 in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2008, 14: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
  •  
Qt is a trademark of The Qt Company.