Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMetaObject problem with QPushButton connection
Forum Updated to NodeBB v4.3 + New Features

QMetaObject problem with QPushButton connection

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 693 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Endless77
    wrote on last edited by
    #1

    In the .h file for my class, I define a QPushButton as well as the function that will be called. It looks like this:

    private slots:
    void on_bubbleTypeButton_clicked();

    private:
    QPushButton *bubbleTypeButton;

    Then in the constructor for the class, I create the button with this code:

    bubbleTypeButton = new QPushButton(this);
    bubbleTypeButton->setGeometry(400, 168, 250, 40);
    connect(bubbleTypeButton, SIGNAL(clicked()), this, SLOT(on_bubbleTypeButton_clicked()));
    

    The code compiles fine, but when I run the code, I get the following message:
    QMetaObject::connectSlotsByName: No matching signal for on_bubbleTypeButton_clicked()

    When I click the button, the on_bubbleTypeButton_clicked function runs, but obviously I don't want the error message. What did I miss?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi and welcome
      Qt has a auto connect feature that trigger via naming. on_widgetname_signal syntax.
      Since you are using a manual connect, please try to rename
      slot so its not on_xxx syntax.
      Then clean build folder.
      run qmake
      and rebuild all.
      That normally shut it up :)

      1 Reply Last reply
      2
      • E Offline
        E Offline
        Endless77
        wrote on last edited by
        #3

        Yes, that did it. Thanks

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved