Results 1 to 3 of 3

Thread: QSlider: emitting a signal with different parameter type

  1. #1
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QSlider: emitting a signal with different parameter type

    I have a QSlider, and I need a double value.

    I have MySlider based on QSlider
    Qt Code:
    1. class MySlider : public QSlider
    2. {
    3. Q_OBJECT
    4. public:
    5. MySlider();
    6. signals:
    7. void valueChanged ( double );
    8. };
    To copy to clipboard, switch view to plain text mode 
    How can I connect valueChanged(int); to my valueChanged(double);? All Example I found never implement a signal.

    thanks

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSlider: emitting a signal with different parameter type

    make a slot lets say slotIntToDouble(int);
    Qt Code:
    1. connect(this,SIGNAL(valudeChanged(int)),this,SLOT(slotIntToDouble(int)));
    2.  
    3. void MySlider::slotIntToDouble(int value)
    4. {
    5. double d=value;
    6. emit valueChanged(d);
    7. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QSlider: emitting a signal with different parameter type

    It works, thanks

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  3. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  5. Replies: 3
    Last Post: 15th April 2007, 19:16

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.