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. Error when connecting a custom class and MainWindow
Forum Updated to NodeBB v4.3 + New Features

Error when connecting a custom class and MainWindow

Scheduled Pinned Locked Moved Solved General and Desktop
classconnectconnect problemsignalsslots
4 Posts 3 Posters 1.3k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1
    This post is deleted!
    JonBJ 1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #4
      This post is deleted!
      1 Reply Last reply
      1
      • ? A Former User

        This post is deleted!

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @Forfunckle
        In a word, especially if you sound like you are writing new Qt code, switch to the new, compile-time-supported way of connecting signals & slots, as documented in https://doc.qt.io/qt-5/signalsandslots.html or read through https://wiki.qt.io/New_Signal_Slot_Syntax, instead of using SIGNAL() & SLOT() macros. You will get a (more) meaningful compile-time error for whatever your fault is.

        In this case, "no known conversion from 'Button *' to 'const QObject *' leads me to wonder what your Button class is? It sounds like it isn't even a QWidget....?

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

          Hi
          the syntax is not correct should be
          connect(button, SIGNAL(sendDeleteSignal()), this, SLOT(checkForDeletes()));
          with no classname:: and would show paramters if it has any.

          Also
          Did you remember Q_OBJECT

          class Button : public QPushButton
          {
          Q_OBJECT

          Please show Buttons .h file

          It must also inherit from a QWidget or QObject which your error suggests you did not.

          And as @JonB says, the new syntax is far better as it helps to find errors.

          connect(button, &Button::sendDeleteSignal, this, &MainWindow::checkForDeletes);

          1 Reply Last reply
          3
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #4
            This post is deleted!
            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