Results 1 to 4 of 4

Thread: problem with signals/slots

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Question problem with signals/slots

    hey guys.In my application i'm creating an instance of Dialogtest(a dialog i created).so whenever that dialog opens up and the user clicks on the find button it invokes finclicked() slot which will emit a signal .
    I used the signal/slot connection mechanism to connect this emitted signal to a slot of the Mainwindow(parent of the dialog).
    The code is compiling but when i run the app and press the find button of the dialog it gives the following error in Application output.



    Object::connect: No such signal Dialogtest::csearch(const QString& a,Qt::CaseSensitivity cs)
    Object::connect: (sender name: 'Dialogtest')
    Object::connect: (receiver name: 'MainWindow')
    Object::connect: No such signal Dialogtest::csearch(const QString& a,Qt::CaseSensitivity cs,const QString& c)
    Object::connect: (sender name: 'Dialogtest')
    Object::connect: (receiver name: 'MainWindow')


    Dialogtest.h is:
    Qt Code:
    1. .........
    2. signals:
    3. void csearch(const QString&,Qt::CaseSensitivity cs);
    4. void csearch(const QString&,Qt::CaseSensitivity cs,const QString&);
    5.  
    6. private slots:
    7. void enablefind();
    8. void findclicked();
    9. ........
    To copy to clipboard, switch view to plain text mode 

    Dialogtest.cpp
    Qt Code:
    1. if(ui->replaceEdit->isEnabled()){
    2. rstring =ui->replaceEdit->text();
    3. emit csearch(fstring,cs,rstring);
    4. }
    5. else{
    6. emit csearch(fstring,cs);}
    To copy to clipboard, switch view to plain text mode 

    Mainwindow.h
    Qt Code:
    1. protected slots:
    2. void sear(QString& c,Qt::CaseSensitivity cs,QString& x);
    3. void sear(QString& c,Qt::CaseSensitivity cs);
    To copy to clipboard, switch view to plain text mode 

    Mainwindow.cpp
    Qt Code:
    1. //inside a function that opens a dialog;
    2. t=new Dialogtest(this);
    3. t->exec();
    4. QObject::connect (t,SIGNAL(csearch(const QString& a,Qt::CaseSensitivity cs)),this,SLOT(sear(const QString& c,Qt::CaseSensitivity cs)));
    5. QObject::connect (t,SIGNAL(csearch(const QString& a,Qt::CaseSensitivity cs,const QString& c)),this,SLOT(sear(const QString& a,Qt::CaseSensitivity cs,const QString& c)));
    To copy to clipboard, switch view to plain text mode 

    the slots sear() are defined in Mainwindow.cpp
    plz help me with this.

  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: problem with signals/slots

    In connect method we only give the argument types for signals and slots. We dont give the argument name.
    So a, cs and c shouldn't be in the connect lines.

  3. #3
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: problem with signals/slots

    thank u...and can any one tell me if it is possible in qt to create custom ui(like u see in Avast antivirus).can it be done using stylesheets or is there any other way(i want to change the title bar also)

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with signals/slots

    Read about style sheets

Similar Threads

  1. Signals and Slots Problem
    By GenericProdigy in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2009, 09:06
  2. Problem with signals & slots
    By Palmik in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2009, 22:45
  3. Signals And Slots problem
    By ldiamond in forum Newbie
    Replies: 7
    Last Post: 23rd March 2008, 00:11
  4. Problem with signals and slots
    By conexion2000 in forum Qt Programming
    Replies: 2
    Last Post: 23rd March 2006, 10:20
  5. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 11:35

Tags for this Thread

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.