本文整理汇总了C++中PluginInfo::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginInfo::isEnabled方法的具体用法?C++ PluginInfo::isEnabled怎么用?C++ PluginInfo::isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginInfo
的用法示例。
在下文中一共展示了PluginInfo::isEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void PluginManager::init()
{
QDir appDirPath = QDir(qApp->applicationDirPath());
QString pluginPath;
if (appDirPath.cd("plugins")) {
pluginPath = appDirPath.absolutePath();
}
if (!pluginPath.isEmpty()) {
QDirIterator it(pluginPath);
SettingsPrivate *settings = SettingsPrivate::instance();
QMap<QString, PluginInfo> plugins = settings->plugins();
QStringList failedPlugins;
while (it.hasNext()) {
if (QLibrary::isLibrary(it.next()) && !it.fileInfo().isSymLink()) {
// If plugin was recognized by the App at least once
if (plugins.contains(it.filePath())) {
PluginInfo pluginInfo = plugins.value(it.filePath());
if (pluginInfo.isEnabled() && !this->loadPlugin(it.filePath())) {
failedPlugins << it.fileName();
}
} else if (!this->loadPlugin(it.filePath())) {
failedPlugins << it.fileName();
}
}
}
// If at least one plugin wasn't restored (API has changed for example)
if (!failedPlugins.isEmpty()) {
this->alertUser(failedPlugins);
}
}
}
示例2:
/** Copy constructor required for converting in QVariant. */
PluginInfo::PluginInfo(const PluginInfo &pluginInfo) :
QObject(pluginInfo.parent())
{
_fileName = pluginInfo.fileName();
_pluginName = pluginInfo.pluginName();
_version = pluginInfo.version();
_configurable = pluginInfo.isConfigurable();
_active = pluginInfo.isEnabled();
}