Results 1 to 2 of 2

Thread: Qt creator C++ error: No documents matching "ui_mainwindow.h" could be found

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2021
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt creator C++ error: No documents matching "ui_mainwindow.h" could be found

    I'm currently using Qt Creator 4.15.2. I tried with creating a new project in the creator, the .h, .cpp, and .ui files are perfectly linked. If I changed anything in the creator, everything is synchronized. When I selected action->Go to slot, it immediately finds everything.

    Then I copied the mainwindow.cpp, mainwindow.h and mainwindow.ui files to my own C++ project. My project has lots of other dependencies so it's hard to create this project directly in the creator. I have successfully included QT5 in my project, so, if I don't use the creator but adding everything manually, everything works fine.

    I added the ui file to my cmake list, then opened the ui file in Qt creator. When I changed anything in the creator, the ui file is synchronized and the ui_mainwindow.h file is generated. The problem then comes, if I click action->Go to slot, this error pops up:

    No documents matching "ui_mainwindow.h" could be found. Rebuilding the project might help.

    I have tried every method online but none of them worked. Now if I want to include the actions, I have to manually add them in the ui_mainwindow.h file (in this way, it wouldn't automatically add the actions) or mainwindow.h file, which is tedious. Does anyone have an idea of how this could be solved?

    Thank you very much!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,249
    Thanks
    304
    Thanked 868 Times in 855 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt creator C++ error: No documents matching "ui_mainwindow.h" could be found

    I have to manually add them in the ui_mainwindow.h file
    Never manually edit the auto-generated files, like ui_*.h, moc_*.cpp, etc. Any changes you make will be wiped out next time the UIC or MOC tools execute on your .ui file.

    Sounds to me like your qmake ,pro file is out of sync with your project. Make sure that everything that was in the ,pro file from the first project is present in the .pro file for the second, non-working project. Manually re-run qmake on this .pro file.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QML: module "QtQuick.Controls" plugin "qtquickcontrolsplugin" not found on iOS
    By ChristianH in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd August 2015, 18:53
  2. Replies: 11
    Last Post: 2nd April 2015, 10:11
  3. Replies: 1
    Last Post: 10th June 2013, 18:22
  4. Replies: 32
    Last Post: 26th August 2012, 00:10
  5. Replies: 2
    Last Post: 11th June 2010, 19:30

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.