Qtѧϰ֮·(10):Meta-Objectϵͳ
Ç°Ãæ˵¹ý£¬QtʹÓõÄÊÇ×Ô¼ºµÄÔ¤±àÒëÆ÷£¬ËüÌṩÁ˶ÔC++µÄÒ»ÖÖÀ©Õ¹¡£ÀûÓÃQtµÄÐźŲۻúÖÆ£¬¾Í¿ÉÒ԰ѱ˴˶ÀÁ¢µÄÄ£¿éÏ໥Á¬½ÓÆðÀ´£¬²»ÐèҪʵÏÖÖªµÀÄ£¿éµÄÈκÎϸ½Ú¡£ ΪÁË´ïµ½Õâ¸öÄ¿µÄ£¬QtÌá³öÁËÒ»¸öMeta-Objectϵͳ¡£ËüÌṩÁËÁ½¸ö¹Ø¼üµÄ×÷ÓãºÐźŲۺÍÄÚÊ¡¡£ ÃæÏò¶ÔÏó³ÌÐòÉè¼ÆÀïÃæ»á½²µ½SmalltalkÓïÑÔÓÐÒ»¸öÔªÀàϵͳ¡£ËùνԪÀ࣬¾ÍÊÇÕâÀïËù˵µÄMeta-Class¡£Èç¹ûд¹ýHTML£¬»áÖªµÀ HTML±êÇ©ÀïÃæÒ²ÓÐÒ»¸ö<meta>£¬ÕâÊÇÓÃÓÚ˵Ã÷Ò³ÃæµÄijЩÊôÐԵġ£Í¬Ñù£¬QtµÄMeta-ObjectϵͳҲÊÇÀàËƵÄ×÷Óá£ÄÚÊ¡ÓÖ³ÆΪ·´É䣬ÔÊÐí³ÌÐòÔÚÔËÐÐʱ»ñµÃÀàµÄÏà¹ØÐÅÏ¢£¬Ò²¾ÍÊÇmeta-information¡£Ê²Ã´ÊÇmeta-informationÄØ£¿¾ÙÀýÀ´Ëµ£¬ÏñÕâ¸öÀà½ÐʲôÃû×Ö£¿ËüÓÐʲôÊôÐÔ£¿ÓÐʲô·½·¨£¿ËüµÄÐźÅÁÐ±í£¿ËüµÄ²ÛÁÐ±í£¿µÈµÈÕâЩÐÅÏ¢£¬¾ÍÊÇÕâ¸öÀàµÄmeta-information£¬Ò²¾ÍÊÇ“ÔªÐÅÏ¢”¡£Õâ¸ö»úÖÆ»¹ÌṩÁ˶Թú¼Ê»¯µÄÖ§³Ö£¬ÊÇQSA(Qt Script for Application)µÄ»ù´¡¡£ ±ê×¼C++²¢Ã»ÓÐQtµÄmeta-informationËùÐèÒªµÄ¶¯Ì¬meta-information¡£ËùÒÔ£¬QtÌṩÁËÒ»¸ö¶ÀÁ¢µÄ¹¤¾ß£¬moc£¬Í¨¹ý¶¨ÒåQ_OBJECTºêʵÏÖµ½±ê×¼C++º¯ÊýµÄת±ä¡£mocʹÓô¿C++ʵÏֵģ¬Òò´Ë¿ÉÒÔÔÙÈκαàÒëÆ÷ÖÐʹÓᣠÕâÖÖ»úÖƹ¤×÷¹ý³ÌÊÇ£º Ê×ÏÈ£¬Q_OBJECTºêÉùÃ÷ÁËһЩQObject×ÓÀà±ØÐëʵÏÖµÄÄÚÊ¡µÄº¯Êý£¬ÈçmetaObject()£¬tr(),qt_metacall()µÈ£» µÚ¶þ£¬QtµÄmoc¹¤¾ßʵÏÖQ_OBJECTºêÉùÃ÷µÄº¯ÊýºÍËùÓÐÐźţ» µÚÈý£¬QObject³ÉÔ±º¯Êýconnect()ºÍdisconnect()ʹÓÃÕâЩÄÚÊ¡º¯ÊýʵÏÖÐźŲ۵ÄÁ¬½Ó¡£ ÒÔÉÏÕâЩ¹ý³ÌÊÇqmake£¬mocºÍQObject×Ô¶¯´¦ÀíµÄ£¬Äã²»ÐèҪȥ¿¼ÂÇËüÃÇ¡£Èç¹ûʵÏÖºÃÆæµÄ»°£¬¿ÉÒÔͨ¹ý²é¿´QMetaObjectµÄÎĵµºÍmocµÄÔ´´úÂëÀ´Ò»¶Ã·¼ÈÝ¡£ ³ö´¦: http://devbean.blog.51cto.com/448512/199472 |
ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»! |
- WindowsÏÂÍê³É¶Ë¿ÚÒÆÖ²LinuxϵÄepoll£¨Ðø£©
- ie6ÆÕ¼°µÄ´ó»·¾³ÏÂÔÝʱ²»Òª¿¼ÂÇw3c±ê×¼
- ÕÐLinux/UNIXͼÊé¼æÖ°×÷Õß
- ʹÓÃJFreeChart´´½¨Í¼Ïó - ±à³ÌÈëÃÅÍø
- »îÓÃSwishÖеÄAction£¨ËÄ£©
- Photoshop¼òµ¥ÖÆ×÷ͼƬ͸Ã÷ˮӡ
- linux ÐÞ¸ÄÖ÷»úÃû ÐÞ¸Äip
- ext3grep»Ö¸´linuxÏÂÎóɾ³ýµÄÎļþ
- Java Reflection API¼ò½é - ±à³ÌÈëÃÅÍø
- Access2007»ù´¡½Ì³Ì£ºAccess Êý¾Ý¿âÊõÓï