本文整理汇总了C++中QDesignerWidgetDataBaseItemInterface::name方法的典型用法代码示例。如果您正苦于以下问题:C++ QDesignerWidgetDataBaseItemInterface::name方法的具体用法?C++ QDesignerWidgetDataBaseItemInterface::name怎么用?C++ QDesignerWidgetDataBaseItemInterface::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDesignerWidgetDataBaseItemInterface
的用法示例。
在下文中一共展示了QDesignerWidgetDataBaseItemInterface::name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: grabDefaultPropertyValues
void WidgetDataBase::grabDefaultPropertyValues()
{
const int itemCount = count();
for (int i = 0; i < itemCount; ++i) {
QDesignerWidgetDataBaseItemInterface *dbItem = item(i);
const QList<QVariant> default_prop_values = defaultPropertyValues(dbItem->name());
dbItem->setDefaultPropertyValues(default_prop_values);
}
}
示例2: slotRemove
void QDesignerPromotionDialog::slotRemove() {
unsigned flags;
QDesignerWidgetDataBaseItemInterface *dbItem = databaseItemAt(m_treeView->selectionModel()->selection(), flags);
if (!dbItem || (flags & Referenced))
return;
QString errorMessage;
if (m_promotion->removePromotedClass(dbItem->name(), &errorMessage)) {
slotUpdateFromWidgetDatabase();
} else {
displayError(errorMessage);
}
}
示例3: grabStandardWidgetBoxIcons
void WidgetDataBase::grabStandardWidgetBoxIcons()
{
// At this point, grab the default icons for the non-custom widgets from
// the widget box. They will show up in the object inspector.
if (const QDesignerWidgetBox *wb = qobject_cast<const QDesignerWidgetBox *>(m_core->widgetBox())) {
const QString qWidgetClass = QLatin1String("QWidget");
const int itemCount = count();
for (int i = 0; i < itemCount; ++i) {
QDesignerWidgetDataBaseItemInterface *dbItem = item(i);
if (!dbItem->isCustom() && dbItem->icon().isNull()) {
// Careful not to catch the layout icons when looking for
// QWidget
const QString name = dbItem->name();
if (name == qWidgetClass) {
dbItem->setIcon(wb->iconForWidget(name, QLatin1String("Containers")));
} else {
dbItem->setIcon(wb->iconForWidget(name));
}
}
}
}
}
示例4: loadPlugins
void WidgetDataBase::loadPlugins()
{
typedef QMap<QString, int> NameIndexMap;
typedef QList<QDesignerWidgetDataBaseItemInterface*> ItemList;
typedef QMap<QString, QDesignerWidgetDataBaseItemInterface*> NameItemMap;
typedef QSet<QString> NameSet;
// 1) create a map of existing custom classes
NameIndexMap existingCustomClasses;
NameSet nonCustomClasses;
const int count = m_items.size();
for (int i = 0; i < count; i++) {
const QDesignerWidgetDataBaseItemInterface* item = m_items[i];
if (item->isCustom() && !item->isPromoted())
existingCustomClasses.insert(item->name(), i);
else
nonCustomClasses.insert(item->name());
}
// 2) create a list plugins
ItemList pluginList;
const QDesignerPluginManager *pm = m_core->pluginManager();
foreach(QDesignerCustomWidgetInterface* c, pm->registeredCustomWidgets())
pluginList += createCustomWidgetItem(c, pm->customWidgetData(c));
// 3) replace custom classes or add new ones, remove them from existingCustomClasses,
// leaving behind deleted items
unsigned replacedPlugins = 0;
unsigned addedPlugins = 0;
unsigned removedPlugins = 0;
if (!pluginList.empty()) {
ItemList::const_iterator cend = pluginList.constEnd();
for (ItemList::const_iterator it = pluginList.constBegin();it != cend; ++it ) {
QDesignerWidgetDataBaseItemInterface* pluginItem = *it;
const QString pluginName = pluginItem->name();
NameIndexMap::iterator existingIt = existingCustomClasses.find(pluginName);
if (existingIt == existingCustomClasses.end()) {
// Add new class.
if (nonCustomClasses.contains(pluginName)) {
designerWarning(tr("A custom widget plugin whose class name (%1) matches that of an existing class has been found.").arg(pluginName));
} else {
append(pluginItem);
addedPlugins++;
}
} else {
// replace existing info
const int existingIndex = existingIt.value();
delete m_items[existingIndex];
m_items[existingIndex] = pluginItem;
existingCustomClasses.erase(existingIt);
replacedPlugins++;
}
}
}
// 4) remove classes that have not been matched. The stored indexes become invalid while deleting.
if (!existingCustomClasses.empty()) {
NameIndexMap::const_iterator cend = existingCustomClasses.constEnd();
for (NameIndexMap::const_iterator it = existingCustomClasses.constBegin();it != cend; ++it ) {
const int index = indexOfClassName(it.key());
if (index != -1) {
remove(index);
removedPlugins++;
}
}
}
if (debugWidgetDataBase)
qDebug() << "WidgetDataBase::loadPlugins(): " << addedPlugins << " added, " << replacedPlugins << " replaced, " << removedPlugins << "deleted.";
}