Results 1 to 4 of 4

Thread: QRadioButton

  1. #1
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QRadioButton

    Hi,
    I have a QRadioButton in my program. I need to call a function named " ClickedSize(int) " when i click on that option button. So I connect that RadioButton like this,

    connect( SubQCIFRadioButton, SIGNAL( toggled(bool) ), this, SLOT( ClickedSize(int) ) );

    but, when I run my program, a message is display like this,
    ================================================== =
    QObject::connect: Incompatible sender/receiver arguments QRadioButton::toggled(bool) --> CVideoSettings::ClickedSize(int)
    ================================================== ==

    why this error? please help me

  2. #2
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QRadioButton

    you just want to enable the button?
    than try
    connect( SubQCIFRadioButton, SIGNAL( toggled(bool) ), this, SLOT( setEnabled(bool) ) );
    because you call a SIGNAL with a bool parameter for a SLOT with a int parameter. these types are incompatible.

  3. #3
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QRadioButton

    Hi,
    I need to run a function when I click on the Radiobutton.
    When I use like this,
    connect( SubQCIFRadioButton, SIGNAL( clicked(int) ), this, SLOT( ClickedSize(int) ) );

    it display anothr message
    ==============================================
    Object::connect: No such signal QRadioButton::clicked(int)
    Object::connect: (sender name: 'SubQCIFRadioButton')
    =======================================
    why?
    Last edited by sabeesh; 8th October 2007 at 07:24.

  4. #4
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QRadioButton

    You want to call the function ClickedSize(int). But what value do you want the int parameter to have? Qt can't guess this for you. That's why it expects the signal to have compatible argument types, to pass this information on to the slot.

    As for the second error message, there simply is no clicked(int) signal.

    I guess you want to call ClickedSize with a fixed argument. Create a new slot that takes no arguments and calls ClickedSize with the value you need. Connect the clicked() signal to that slot.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

Similar Threads

  1. Replies: 26
    Last Post: 21st July 2007, 21:34
  2. setVisible, -> token, problems
    By Salazaar in forum Newbie
    Replies: 25
    Last Post: 12th June 2007, 14:30

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.