In 'promotion' of QtDesigner , header file and subclass name is needed , in Draft preference page 'userprefs-base.ui' , buttons belong to class 'Gui:PrefColorButton' , in my editing , I could see the 'Gui:PrefColorButton' option , but the 'Promote' button is unabled when I selected 'Gui:PrefColorButton' . Is this because I didn't put relevant header files in right place ? Then should I copy relevant header files ? If I don't need do this , how does QtDesigner know and use this class ?
I don't know how the "Promoted widgets" function is supposed to work in QtDesigner but you don't need this if you have a working plugin. The plugin contains all the required information and put this into the .ui file. If you open the .ui file you'll find a section <customwidgets> where class name, base class and header file is listed.
btw , I have a irrelevant question , .ui file is a txt file without implement , QtDesigner doesn't need to know the structrue of classes , then what is the role of FreeCAD_widgets plugin to QtDesigner ?
This is to make FreeCAD widgets behave as built-in Qt widgets, i.e. you can choose them from the widget box and drag and drop them to the UI form.