×

Discussion Board

Results 1 to 3 of 3

Thread: Custom Signals

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    2

    Custom Signals

    Hi, I am new to Qt.

    I am writing a small app for my N900 which displays the dip switch settings for various devices which are used in my line of work. The dip switches represent unique addresses and essentially are just binary numbers (not quite but close enough for this discussion).

    I have a horizontal slider connected to a QLCDNumber, when the slider is used the lcd number displays a value and a custom slot updates a row of 1-digit QLCDNumbers with the not quite binary version of the number which represents the dip switch positions. Its simple and works perfectly well.

    However I would also like the app to work in reverse, i.e. the user toggles the various 'dip switches' (digits of the QLCDNumbers) the first QLCDNumber and slider would then update to represent the relevant number.

    Easy I thought; I'll just use the QLCDNumber's clicked() signal to connect to custom slot to do the work. The user will click on a digit and the digit will toggle between 1 and 0. Then I realised that there isn't a clicked() signal available.

    So after this rather long pre-amble my question is: I know custom signals can be created for my own objects but can I create a custom signal for the existing stuff such as QLCDNumber? Oh and of course; if so how?

    Thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Custom Signals

    Quote Originally Posted by leighw@leigh-moana.com View Post
    Easy I thought; I'll just use the QLCDNumber's clicked() signal to connect to custom slot to do the work. The user will click on a digit and the digit will toggle between 1 and 0. Then I realised that there isn't a clicked() signal available.

    So after this rather long pre-amble my question is: I know custom signals can be created for my own objects but can I create a custom signal for the existing stuff such as QLCDNumber? Oh and of course; if so how?
    Subclass QLCDNumber, define clicked() signal, reimplement mousePressEvent ( QMouseEvent * event )
    http://doc.trolltech.com/4.6/qwidget...ousePressEvent
    emit clicked signal from the event handler.
    Snippets can be found here:
    http://doc.trolltech.com/4.6/signalsandslots.html

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    2

    Re: Custom Signals

    Quote Originally Posted by divanov View Post
    Subclass QLCDNumber, define clicked() signal, reimplement mousePressEvent ( QMouseEvent * event )
    http://doc.trolltech.com/4.6/qwidget...ousePressEvent
    emit clicked signal from the event handler.
    Snippets can be found here:
    http://doc.trolltech.com/4.6/signalsandslots.html
    Excellent... thanks for the reply, I'll give it a go at the weekend. Thanks again.

Similar Threads

  1. Using the font from setting list in custom listbox
    By alav in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-11-05, 17:17
  2. Is Custom Dialog same as adding custom contol to a dialog?
    By ameybarve in forum Symbian User Interface
    Replies: 24
    Last Post: 2008-10-31, 07:55
  3. Need help with custom Item drawer
    By gigglie in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-03-10, 10:49
  4. Custom item not displayed correctly
    By kakoskin in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-10-11, 21:50
  5. Need help! Sending DTMF signals to remote phone
    By HershD in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-06-17, 08:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×