Results 1 to 6 of 6

Thread: [Basic question] Signals & Slot

  1. #1
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy [Basic question] Signals & Slot

    Hi to all,
    I'm starting with QT4 and I need to connect an "int" signal to a "double" slot.
    I've tried with:
    Qt Code:
    1. QSpinBox::connect(mw_ui->spinbox_LineNumber, SIGNAL(valueChanged(int)), &(*mw_ui->qwtSlider_LineNumber), SLOT(setValue(double)));
    To copy to clipboard, switch view to plain text mode 

    but I receive the message:
    Incompatible sender/receiver...

    I've searched on google how to solve this problem.. but I havn't find nothing..
    could someone help me?
    Thanks
    GortiZ

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [Basic question] Signals & Slot

    Hi,

    You can't connect a signal that emits a type and a slot that recives another type.

    Read the doc about signals and slots.
    Òscar Llarch i Galán

  3. The following user says thank you to ^NyAw^ for this useful post:

    GortiZ (1st April 2008)

  4. #3
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Basic question] Signals & Slot

    I've already readed that I can't connect different types, but I need to change the value in the spinbox with the one in the slider so i'm asking if there's a way to do this or a workaround to make this working..

    Thanks for the answer

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Basic question] Signals & Slot

    Create a custom slot and connect the signal to it and from the custom slot simply call the original slot as a regular function.

  6. #5
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [Basic question] Signals & Slot

    sorry i'm a newbye.. could you link me to a page where i can find a documentation on how to create custom slots?

    Thanks a lot

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Basic question] Signals & Slot

    It's all in Qt's documentation. Read the tutorial there.

  8. The following user says thank you to wysota for this useful post:

    GortiZ (1st April 2008)

Similar Threads

  1. many signals, one slot
    By eric in forum Qt Programming
    Replies: 5
    Last Post: 24th January 2008, 07:25
  2. Signals and slot
    By rajeshclt3 in forum Newbie
    Replies: 1
    Last Post: 29th November 2007, 12:41

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.