Results 1 to 6 of 6

Thread: Help with Signals and slots

  1. #1
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Help with Signals and slots

    Hi,
    I want to know whether it is possible to modify the Clicked signal for push button to make it take a parameter. I know that we can define a new signal which can take a parameter.


    Thanks,

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Help with Signals and slots

    What are you want to do with it? I guess you are looking for QSignalMapper.

  3. #3
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Help with Signals and slots

    I want to write a Keyboard for a touch screen device, so if i am able to pass the text of the push button as a parameter, I can connect all the signal to a single slot the accepts characters and set the text of the display.

    are we not supposed to do it that way ..what could be the best way possible.?

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Help with Signals and slots

    Just extend QPushButton, connect its own clicked() signal to an internal function that emits a new signal containing the button's value.

  5. #5
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Help with Signals and slots

    Can you explain me a bit more about extending QPushButton or where to find the documentation on it .

    Thanks .

  6. #6
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Help with Signals and slots

    Inherit a new class from it, and add your own functions. Straight-up C++, OO design.

  7. The following user says thank you to SixDegrees for this useful post:

    chetu1984 (10th March 2011)

Similar Threads

  1. regarding signals/slots
    By jjbabu in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2007, 09:32
  2. Signals and slots
    By sylvarant in forum Newbie
    Replies: 4
    Last Post: 11th September 2007, 15:48
  3. Signals and Slots
    By merry in forum Qt Programming
    Replies: 4
    Last Post: 22nd February 2007, 08:11
  4. help with signals and slots
    By superutsav in forum Qt Programming
    Replies: 3
    Last Post: 4th May 2006, 12:49
  5. Signals and Slots in dll
    By ankurjain in forum Qt Programming
    Replies: 8
    Last Post: 29th March 2006, 08:12

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.