×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  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
    Nokia Developer Champion
    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?

  5. #5
    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?

  6. #6
    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.

  7. #7
    Nokia Developer Champion
    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.

  8. #8
    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!!!

  9. #9
    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.

  10. #10
    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()

  11. #11
    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?

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

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

    The reason for this message is that you have an object with slot on_pushButton_clicked and this object doesn't have an object with name pushButton among its children or this object doesn't have clicked signal.

  13. #13
    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
    The reason for this message is that you have an object with slot on_pushButton_clicked and this object doesn't have an object with name pushButton among its children or this object doesn't have clicked signal.
    Ok divanov,

    then how can I call another UI window by a button click. Do I need to do some thing extra to load another window like the follow piece of code?

    MapsMainWindow w;//Loads mapsmainwindow.ui
    w.showMaximized();////mapsmainwindow.ui displayed in maximized mode

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

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

    Quote Originally Posted by RajeevSahu View Post
    then how can I call another UI window by a button click.
    One of the possible solutions:
    http://wiki.forum.nokia.com/index.ph...ows_in_Maemo_5

  15. #15
    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
    Hey...

    I have tried as per the link provided by You but I am getting one error like:
    undefined reference to `MainScreen::MainScreen(QWidget*)'
    The file contents are as follows:

    mainwindow.h..............

    #include <QMainWindow>
    #include "screen.h"
    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private:
    Ui::MainWindow *ui;

    private:
    void CreateButton();

    private slots:
    void buttonClicked(bool checked = false);
    void windowDestroyed(QObject* obj = 0);

    private:
    MainScreen *mainScreen;
    };
    mainwindow.cpp........

    #include "mainwindow.h"
    #include "ui_mainwindow.h"

    #include <QMessageBox>
    #include <QPushButton>
    #include <QDebug>
    //#include "screen.h"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),mainScreen(0),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    setWindowTitle("DisplayMyWindow");
    CreateButton();
    }

    void MainWindow::buttonClicked(bool checked)
    {
    Q_UNUSED(checked);

    if (!mainScreen) {
    mainScreen = new MainScreen(this);
    mainScreen ->setAttribute(Qt::WA_DeleteOnClose);
    connect(mainScreen, SIGNAL(destroyed(QObject*)),this, SLOT(windowDestroyed(QObject*)));
    mainScreen->showMaximized();
    qDebug() << "Show Map" << mainScreen;
    }
    }
    void MainWindow::windowDestroyed(QObject* obj)
    {
    disconnect(obj, SIGNAL(destroyed(QObject*)),this, SLOT(windowDestroyed(QObject*)));
    qDebug() << "No Show Map" << mainScreen;
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::CreateButton()
    {
    QPushButton *startmapBtn = new QPushButton();
    startmapBtn->setText("MapStart");
    startmapBtn->setGeometry(QRect(150, 400, 135, 50));
    connect(startmapBtn, SIGNAL(clicked(bool)), this, SLOT(buttonClicked(bool)));
    }
    screen.h......
    #include "ui_showmap.h"
    #include <QtGui>
    #include <QWidget>
    #include <QWebView>
    #include <QStandardItemModel>

    class MainScreen : public QWidget ,public Ui::Form
    {
    Q_OBJECT
    public :
    MainScreen(QWidget *parent=0);

    public slots :
    void on_button1_clicked();
    };
    screen.cpp......

    #include "screen.h"
    #include "ui_showmap.h"
    #include <QWebView>
    #include <QHeaderView>
    #include <QWebFrame>
    #include <QWebPage>

    MainScreen::MainScreen(QWidget *parent):QWidget(parent)
    {
    setupUi(this);
    //map->load(QUrl("http://www.trolltech.com/"));
    //map->load(QUrl("./index.html") ) ;
    }

    void MainScreen:n_button1_clicked()
    {
    //map->clearCoordinates();
    //map->geoCode("Campina Grande");
    }
    Please help me to figure out the problem!

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
  •