×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Hi friends,

    I am working on a GUI project. I have 2 .ui files mainwindow.ui and mapsmainwindow.ui.

    My main.cpp contains the folowing etails:

    Code:
    #include <QtGui/QApplication>
    #include "mainwindow.h"
    int main(int argc, char *argv[])
    {    
        QApplication a(argc, argv);
        MainWindow w;
        #if defined(Q_WS_S60)
           w.showMaximized();
        #else
            w.show();
        #endif
    
        return a.exec();
    }
    mainwindow.h contains:

    Code:
    public Q_SLOTS: //slots to receive action of menu trigger.
       void ShowAction();
    private slots:
        void on_pushButton_clicked();
    In mainwindow.cpp I am trying to use the following 2 functions like :

    Code:
    void MainWindow::ShowAction()
    {
    
        MapsMainWindow w;//Loads mapsmainwindow.ui
        #if defined(Q_WS_S60)
            w.showMaximized();////mapsmainwindow.ui displayed in maximized mode
        #else
            w.show();
        #endif
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        ShowingAction();
    }
    With above implementations I am able to Build successfully, but when the application is installed on device, it is giving warnings every time i clicked the pushButton and nothing happens:

    Warnings are like:

    Code:
    [Qt Message] QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()
    [Qt Message] QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()
    Please guide me on this issue.

    Thanks...

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Do you set "pushButton" name for your button?
    http://doc.trolltech.com/4.6/qobject...bjectName-prop

  3. #3
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    yes.
    ui_mainwindow.hcontains this button.

    class Ui_MainWindow
    {
    public:
    QWidget *centralWidget;
    QPushButton *pushButton;

    void setupUi(QMainWindow *MainWindow)
    {
    if (MainWindow->objectName().isEmpty())
    MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
    MainWindow->resize(469, 640);
    centralWidget = new QWidget(MainWindow);
    centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
    centralWidget->setEnabled(true);
    pushButton = new QPushButton(centralWidget);
    pushButton->setObjectName(QString::fromUtf8("pushButton"));
    pushButton->setGeometry(QRect(150, 320, 101, 41));
    MainWindow->setCentralWidget(centralWidget);
    pushButton->raise();

    retranslateUi(MainWindow);

    QMetaObject::connectSlotsByName(MainWindow);
    } // setupUi

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Could you please share the whole project? You can use http://www.mediafire.com, or any other file sharing service.

  5. #5
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Hi divanov,
    very strange!!!
    Yesterday it was giving error, but now it's working very fine. No issues.
    I don't know how this thing has happened.

    Anyways, Thanks a lot. This issue is fixed.

    Regards,
    Rajeev

  6. #6
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Where are your connect() statements?

  7. #7
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Quote Originally Posted by danhicksbyron View Post
    Where are your connect() statements?
    QMetaObject::connectSlotsByName is used instead.

  8. #8
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Quote Originally Posted by divanov View Post
    QMetaObject::connectSlotsByName is used instead.
    ui_mainwindow.hcontains this.

  9. #9
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Quote Originally Posted by danhicksbyron View Post
    Where are your connect() statements?
    I don't have any connect statements!!!

  10. #10
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    This is really strange. Can you share the whole project?

  11. #11
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    hello to all..
    i am getting the same problem of
    QMetaObject::connectSlotsByName: No matching signal for on_closeButton_clicked()

    can anyone please tell me, what you did to counter this problem?

  12. #12
    Registered User
    Join Date
    Dec 2013
    Posts
    1

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Actually it is simple.
    The on_<objectname>_<signalname>() is something that setup(Ui); uses to automatically make the connect.

    Solution: Just remove everywhere the on_, add manually a connect statement and the message is gone.

    In your case: on_closeButton_clicked() remove on_ to get closeButton_clicked().
    You have to add (at the right place) a connect statement yourself:
    connect(<someobject>,SIGNAL(<somesignal>),<someotherobject>,SLOT(closeButton_clicked()));

    The <somesignal> is probably clicked().


    Quote Originally Posted by shantanu_sharma View Post
    hello to all..
    i am getting the same problem of
    QMetaObject::connectSlotsByName: No matching signal for on_closeButton_clicked()

    can anyone please tell me, what you did to counter this problem?

  13. #13
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    I'm guessing it can't be a private slot and be connected from another object. It can be private and have MainWindow execute a connect(), however.

  14. #14
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Quote Originally Posted by danhicksbyron View Post
    I'm guessing it can't be a private slot and be connected from another object. It can be private and have MainWindow execute a connect(), however.
    I made it public but same thing happens:
    [Qt Message] QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

  15. #15
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()

    Hey...

    Little update on this issue.

    In mainwindow.cpp I have changed the following 2 functions like :


    void MainWindow::ShowAction()
    {

    /*MapsMainWindow w;//Loads mapsmainwindow.ui
    #if defined(Q_WS_S60)
    w.showMaximized();////mapsmainwindow.ui displayed in maximized mode
    #else
    w.show();
    #endif*/
    QMessageBox msgBox;
    msgBox.setInformativeText("slot executed...");
    msgBox.setStandardButtons(QMessageBox::Ok);
    int ret = msgBox.exec();
    }

    void MainWindow:n_pushButton_clicked()
    {
    ShowingAction();
    }
    The above code is executed and message is displayed when I click the Button. How ever When I tried to call another UI (
    MapsMainWindow w; w.showMaximized();
    ) it is giving the warning explained before.
    [Qt Message] QMetaObject::connectSlotsByName: No matching signal for on_pushButton_clicked()
    Why is this thing happening....Is there any differentiation between the 2 implementations in the
    void MainWindow::ShowAction()
    function?

Similar Threads

  1. Replies: 6
    Last Post: 2010-03-20, 14:06
  2. Cell Matching
    By soni_neeraj in forum Symbian
    Replies: 4
    Last Post: 2009-04-08, 07:31
  3. String Matching
    By jetsetgo in forum Symbian
    Replies: 4
    Last Post: 2006-06-15, 15:23
  4. next sync anchor not matching
    By sunilm in forum OMA DM/DS/CP
    Replies: 1
    Last Post: 2005-03-28, 12:24
  5. Crash with CAknSelectionListDialog / incremental matching
    By delwynh in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-11-13, 00:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×