Unsolved Change one object name in UI Designer and get an error in signals.
-
Hello everyone and thanks for reading this topic!
I´m a little bit confused with Qt Designer. I have a button that produces some signals with its pertinent slots.
Let´s think for example that this button is called "MyButton". So the slot´s name for a clicked signal would be:onMyButtonClicked()
Okey, then lets change the button´s name in Designer to "AnotherNameButton". Obviously the slots name should change in the way they should be seen like this:
onAnotherNameButtonClicked()
But this is not happening and so I am getting some errors in the file: moc_gui.cpp because there is no reference for the previous slot!
The question is, how can I refactor all slots and signals name that depends on a widget(button or whatever) when I change it from Qt Designer?
Thanks a lot!
-
I don't think its possible.
-
Hello @AlvaroGJ ,
Let´s think for example that this button is called "MyButton". So the slot´s name for a clicked signal would be: onMyButtonClicked();
-> These are names given by default from Qt Designer.Okey, then lets change the button´s name in Designer to "AnotherNameButton". Obviously the slots name should change in the way they should be seen like this: onAnotherNameButtonClicked()
-> Changing name of the button can not do "renaming the slot name". If you are doing it on the same button "MYButton".
To my knowledge , you have to do it manually. Change the QObject name in the ui file. and then in code use the "refactor."It will rename in all files of the project.
If your are changing the only SLOT name , right click on "onMyButtonClicked();" ->Refactor->Rename symbol under cursor , will change.Have to be very careful when you are renaming ui files, or widgets in .ui .