I'm trying to add a slot through the ui designer in QtCreator, and I get this error, I've tried rebuilding the project, made sure the header is there, deleted it so it was recreated, nothing seems to fix it, anyone know why this is happening?
I'm trying to add a slot through the ui designer in QtCreator, and I get this error, I've tried rebuilding the project, made sure the header is there, deleted it so it was recreated, nothing seems to fix it, anyone know why this is happening?
I have got the same problem. Any suggestion, please?
In my case this was because of manually multy-renaming class name from class_name to ClassName. Then class_name.h, ui_class_name.h include entries, CLASSNAME_H define entries and other occurences were renamed too in project files. Changes which caused project not to build was fixed by me but the rest were related to this "Error finding/adding a slot" problem:in classname.h andQt Code:
#ifndef ClassName_H #define ClassName_HTo copy to clipboard, switch view to plain text modein classname.cpp.Qt Code:
#include ClassName.h #include ui_ClassName.hTo copy to clipboard, switch view to plain text mode
When I fixed it (1st should be in UPPERCASE, 2nd in lowercase) all went good.
By the way, in error dialog box there waswhich is confusing because there WAS file named exactly "classname.h" in appropriate directory.Cannot find classname.h
serjik (6th July 2013)
i got this message:
Error finding/adding a slot.
No documents matching 'ui_MainWindow.h' could be find.
Rebuilding the project might help.
And i solved it:
i renamed my source files to lowercase character and also renamed those in xx.prj file and #include "mainwindow.h" in used files.
just it.
I have not found xx.prj. Just only .pro
Hello I stumpled to this exact same error and discovered after 2 hours debuggin where the error is happening.
If you have namespace Ui
you must have in header:
Private:
Ui::MyClass *ui
Then in CPP you need to have #Include "MyClass.h" #Include "ui_MyClass.h" and in the code you must have:
ui(new Ui::MyClass) in the constructor statement.
Then only the Creator finds the ui file.
My problem was that I had several Namespaces like:
namespace MyApp { namespace core { namespace gui { class MyClass
When using some other namespace than Ui the creator cannot turn Ui::MyClass to pruple meaning that it indicates that code works. SO I changed it to MyApp::core::gui::MyClass *ui
This did break the Creator finding slot where Ui is. Changed that line in header back to Ui::MyClass *ui and then slots worked in Designer again. How ever for some reason the creator editor cannot understand the Ui::MyClass *ui because the namespace Ui does not exist. This may be a creator bug.
Hope this helps.
Bookmarks