When MotionBuilder starts, QtSample DLL is loaded, but no QtSample instance is created. Only when a plugin is run, the QtSample, FBWidgeHolder and xxx instance are created like the below sequence:
 
 
            Let’s see the track to the code to see details:
Until now the UI has been created and shown in screen. But how to respond to the button click event?
Do you feel strange about xxx::qt_metacall(…)? You haven't created it. Actually it is created when compiler creates moc_xxx.cpp files by MOC commands. Below graphic show you which file could generate which file by which command:
 
 
            Each file’s responsibilities have been shown in below graphic:
 
 
            You can find the use of UIC in xxx.ui file's property:
 
 
            You can find the use of MOC in xxx.h file's property:
 
 
         You may get confused that you cannot find the DllMain(…) method, the DLL entry point. Actually it is generated by below MICRO in qtsample_tool.cpp file.
// Library declaration.
FBLibraryDeclare( qtsample )
{
	FBLibraryRegister( QtSample );
}
FBLibraryDeclareEnd;
After compiling the qtsample_tool.i file you can see it clearly:
static FBLibrary qtsampleGlobalFBLibrary; 
extern "C" 
{ 
    __declspec(dllexport) 
    bool LIBRARY_INIT(HIError ) 
    { 
        ; 
        if (qtsampleGlobalFBLibrary.LibInit()) 
            return true; 
        return false; 
    } 
} 
__declspec(dllexport) void EntryPointqtsample(kFBDllOperation Operation); 
BOOL __stdcall DllMain(HINSTANCE hinstDLL,DWORD fdwReason, LPVOID lpvReserved ) 
{ 
    switch (fdwReason) 
    { 
        case 1: EntryPointqtsample(kFBDllLoad); break; 
        case 0: EntryPointqtsample(kFBDllUnLoad); break; 
    } 
    return 1; 
}
void EntryPointqtsample(kFBDllOperation Operation) 
{ 
    switch( Operation ) 
    { 
        case kFBDllLoad: 
        {
            {    
                extern void FBModuleQtSample( ); 
                FBModuleQtSample( );;
            }
        }        break; 
        default: break; 
    } 
};