Results 1 to 6 of 6

Thread: connectSlotsByName and clicked()

  1. #1
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default connectSlotsByName and clicked()

    Hi,

    I'm using the wonderful Qt shortcut "connectSlotsByName" in my application, mostly with clicked() signals in QPushButtons.

    The problem is that attached slots are called twice. As far as I was able to search about that up to now, it seems that Qt fires all slots that are compatible with SIGNAL signature, like clicked that has a default parameter.

    Is it true? Anyway, how can I solve this issue?

    I tried to use normalizedSignature, with no success

    Thank you so much for all help you can give.

    Regards,
    Tony.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: connectSlotsByName and clicked()

    I'm using the wonderful Qt shortcut "connectSlotsByName" in my application, mostly with clicked() signals in QPushButtons.
    How are you using it ? As far as I guess "connectSlotsByName" is function of QMetaObject and is handled by the qmake.

    What do u want to achieve, ad what are u trying ? Can u elaborate ?

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: connectSlotsByName and clicked()

    Just be aware that setupUi() method already calls connectSlotsByName(). That would result to double connections if you, in addition that, do it by hand.
    J-P Nurmi

  4. #4
    Join Date
    Jun 2008
    Location
    Italy
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: connectSlotsByName and clicked()

    Yes, you're right!

    I was thinking of it, travelling from work to home

    Qt's too automatic for me!

    Thanks so much,

    Tony.

  5. #5
    Join Date
    Jul 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: connectSlotsByName and clicked()

    I'm having problem that is driving me nuts. I'm also using setupUi with on_objectName_signalName() connections. When I call:
    Qt Code:
    1. void on_DateButton_clicked()
    2. {
    3. this->setWindowTitle("Some title");
    4. }
    To copy to clipboard, switch view to plain text mode 
    this works fine but:
    Qt Code:
    1. void on_DateButton_clicked()
    2. {
    3. lineEdit_2->insert("Some text");
    4. }
    To copy to clipboard, switch view to plain text mode 
    app crushes.
    Any ideas?
    I appologize for my poor English.

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: connectSlotsByName and clicked()

    are you sure that "lineEdit_2" is class member? are you sure that "lineEdit_2" contains not null pointer? maybe you should use "ui->lineEdit_2" instead.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

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.