• 4081阅读
  • 0回复

请讲讲 QPluginLoader::staticInstances()作用(中文,谢谢啦) [复制链接]

上一主题 下一主题
离线dym123_dym
 
只看楼主 正序阅读 楼主  发表于: 2010-02-09
foreach (QObject *plugin, QPluginLoader::staticInstances())
populateMenus(plugin);



void MainWindow::populateMenus(QObject *plugin)
{
BrushInterface *iBrush = qobject_cast<BrushInterface *>(plugin);
if (iBrush)
addToMenu(plugin, iBrush->brushes(), brushMenu, SLOT(changeBrush()),
brushActionGroup);

ShapeInterface *iShape = qobject_cast<ShapeInterface *>(plugin);
if (iShape)
addToMenu(plugin, iShape->shapes(), shapesMenu, SLOT(insertShape()));

FilterInterface *iFilter = qobject_cast<FilterInterface *>(plugin);
if (iFilter)
addToMenu(plugin, iFilter->filters(), filterMenu, SLOT(applyFilter()));
}
快速回复
限100 字节
 
上一个 下一个