Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68396

undefined reference to 'a_slot()' in moc_a_slot.cpp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.10.0
    • Build tools: moc, Other
    • None
    • Qt Creator 5.10.0

      MinGW 32 bit

      Windows 10

       

      Bonjour,

      Let me first explain  what i want to do with my code before we talk about the errors i encountered later, i think it could be easier for everybody.

      I have a main window (mafenetreprincipale) with two buttons : "options" ( which is useless for the moment because i don't use it, so we don't care ) and "se connecter". After a click on the button "se connecter" i have a second window which opens (mafenetre2) this second window have a button "identifiez-vous" and after a click on it, the window asks for your login.

      Every scenario was working well : login ok, login error, text is empty, after a click on "Annuler" a QMessageBox warning is displayed then a QMessageBox question in order to be sure that the user want to quit or not. So with a click on 'No' the user stays on the login window and a click on 'Yes' and the window is closed.

      I was happy but i noticed that every time i click on the button "se connecter" it makes a new login window open, and i don't want that, I wish one click on "se connecter", one single** active login window only. I know "mafenetreprincipale" is still open behind but it is and it will be my 'mother Window' so it's not a problem.

      I though deactivate with setEnabled(false) the button "se connecter" when a login window is active, which works currently but impossible to reactive the button with setEnabled(true) when the login window is closed. I have the impression that my code never enter in my loop for reactivate the button "se connecter". So i create  a SIGNAL "envoyer" for "mafenetre2" and a SLOT "recevoir" in "mafenetreprincipale" because i don't know how to recup the CloseEvent of my login window with the button "Annuler" in a QMessageBox question.

      Unfortunatly it still doesn't work if i don't use the SLOT "recevoir" i have  'undefined reference to mafeentreprincipale::recevoir()' in the moc_mafenetreprincipale.cpp but if i use it Qt annoy me with 2 errors : expected primary-expression before',' token which mean that something is wrong in my QObject::connect but i don't know what and why.The second error is 'could not convert recevoir from void to bool' in my loop else if.

      I don't know how writte

      if (signal envoyer is emit) {

      button"se connecter"->setEnabled(true);

      }

      I try to send a boolean in a signal for the else if but it's failed again. I already had connect a signal but with a click on a QPushbutton (that i had previously created) tha's why i have some difficulties with this particular signal.

      Thanks for your help

       

       

       

       

       

       

        1. the_two_errors.png
          the_two_errors.png
          53 kB
        2. main.cpp
          1.0 kB
        3. mafenetreprincipale.h
          0.5 kB
        4. mafenetreprincipale.cpp
          1 kB
        5. mafenetre2.h
          0.5 kB
        6. mafenetre2.cpp
          1 kB
        7. error_undefined_reference_inthe_moc.png
          error_undefined_reference_inthe_moc.png
          55 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ogoffart Olivier Goffart (Woboq GmbH)
            coho Cédric Ochsner-Hoffarth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes