Important: Please read the Qt Code of Conduct -

Removed widgets still remain

  • Dear programmers
    I met a problem associated with widget removing, during the construction of a project.
    I created a text editor. I decided to remove a button connected with font style. The next day I decided to remove this button.
    I deleted, also, the function connected with the button in .cpp file as well as in header file.

    When I run the application a message appeared repeatedly in the .moc file:

    The part of code in the moc file is:
    Case 0: t→onSavebtn_clicked(); break;
    Case 1: t→newValues_clicked(); break;
    Case 2: t→onExitRbtn_clicked(); break;
    Case 3: t→onFontbtn_clicked(); break;

    The last button is the one I deleted
    Where is this widget saved and reappear?

    Thanks in advance


  • Lifetime Qt Champion


    @John_Thess said in Removed widgets still remain:


    Do you have that slot declared in your code ?

  • Lifetime Qt Champion

    @John_Thess said in Removed widgets still remain:

    The last button is the one I deleted
    Where is this widget saved and reappear?

    I don't see a widget here. Just some slots. And they're generated because you've it in your header.

  • @Christian-Ehrlicher
    I used a wrong expression. It's not about widgets. just slots in .moc file.
    I restart Qt and the problem didn't appear again.

    The project works properly.

    Something strange appeared:
    In the head file of a simple text editor (included in the whole project) there is something that appears without affecting the operation.

    At the right side of declaration of functions for simple actions (cut, copy, undo ....)
    there are warnings in yellow letters

    private slots:
    void on_cancelNote_clicked();..................Slots named on_foo_bar are error prone [clazy-connect-by-name]

    The rest is the same.
    The application works with no errors.
    Is it something that I could ignore about?

  • I found a solution.
    Follow this link:

    It is recommended to write code for SIGNAL and SLOT connection, instead of choosing "Go to slot" from right click menu.

    Hi everyone

Log in to reply