本文整理汇总了C++中QDesignerPropertySheetExtension::indexOf方法的典型用法代码示例。如果您正苦于以下问题:C++ QDesignerPropertySheetExtension::indexOf方法的具体用法?C++ QDesignerPropertySheetExtension::indexOf怎么用?C++ QDesignerPropertySheetExtension::indexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDesignerPropertySheetExtension
的用法示例。
在下文中一共展示了QDesignerPropertySheetExtension::indexOf方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotNewAction
void ActionEditor::slotNewAction()
{
NewActionDialog dlg(this);
dlg.setWindowTitle(tr("New action"));
if (dlg.exec() == QDialog::Accepted) {
const ActionData actionData = dlg.actionData();
m_actionView->clearSelection();
QAction *action = new QAction(formWindow());
action->setObjectName(actionData.name);
formWindow()->ensureUniqueObjectName(action);
action->setText(actionData.text);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
if (!actionData.toolTip.isEmpty())
setInitialProperty(sheet, QLatin1String(toolTipPropertyC), actionData.toolTip);
if (actionData.checkable)
setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true));
if (!actionData.keysequence.value().isEmpty())
setInitialProperty(sheet, QLatin1String(shortcutPropertyC), QVariant::fromValue(actionData.keysequence));
sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), QVariant::fromValue(actionData.icon));
AddActionCommand *cmd = new AddActionCommand(formWindow());
cmd->init(action);
formWindow()->commandHistory()->push(cmd);
}
}
示例2: manageAction
void ActionEditor::manageAction(QAction *action)
{
action->setParent(formWindow()->mainContainer());
core()->metaDataBase()->add(action);
if (action->isSeparator() || action->menu() != 0)
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
sheet->setChanged(sheet->indexOf(QLatin1String(objectNamePropertyC)), true);
sheet->setChanged(sheet->indexOf(QLatin1String(textPropertyC)), true);
refreshIconPropertyChanged(action, sheet);
m_actionView->setCurrentIndex(m_actionView->model()->addAction(action));
connect(action, SIGNAL(changed()), this, SLOT(slotActionChanged()));
}
示例3: markChangedStretchProperties
void LayoutPropertySheet::markChangedStretchProperties(QDesignerFormEditorInterface *core, QLayout *lt, const DomLayout *domLayout)
{
// While the actual values are applied by the form builder, we still need
// to mark them as 'changed'.
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), lt);
Q_ASSERT(sheet);
if (!domLayout->attributeStretch().isEmpty())
sheet->setChanged(sheet->indexOf(QLatin1String(boxStretchPropertyC)), true);
if (!domLayout->attributeRowStretch().isEmpty())
sheet->setChanged(sheet->indexOf(QLatin1String(gridRowStretchPropertyC)), true);
if (!domLayout->attributeColumnStretch().isEmpty())
sheet->setChanged(sheet->indexOf(QLatin1String(gridColumnStretchPropertyC)), true);
if (!domLayout->attributeColumnMinimumWidth().isEmpty())
sheet->setChanged(sheet->indexOf(QLatin1String(gridColumnMinimumWidthPropertyC)), true);
if (!domLayout->attributeRowMinimumHeight().isEmpty())
sheet->setChanged(sheet->indexOf(QLatin1String(gridRowMinimumHeightPropertyC)), true);
}
示例4: editAction
void ActionEditor::editAction(QAction *action)
{
if (!action)
return;
NewActionDialog dlg(this);
dlg.setWindowTitle(tr("Edit action"));
ActionData oldActionData;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
oldActionData.name = action->objectName();
oldActionData.text = action->text();
oldActionData.toolTip = textPropertyValue(sheet, QLatin1String(toolTipPropertyC));
oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
oldActionData.keysequence = ActionModel::actionShortCut(sheet);
oldActionData.checkable = action->isCheckable();
dlg.setActionData(oldActionData);
if (!dlg.exec())
return;
// figure out changes and whether to start a macro
const ActionData newActionData = dlg.actionData();
const unsigned changeMask = newActionData.compare(oldActionData);
if (changeMask == 0u)
return;
const bool severalChanges = (changeMask != ActionData::TextChanged) && (changeMask != ActionData::NameChanged)
&& (changeMask != ActionData::ToolTipChanged) && (changeMask != ActionData::IconChanged)
&& (changeMask != ActionData::CheckableChanged) && (changeMask != ActionData::KeysequenceChanged);
QDesignerFormWindowInterface *fw = formWindow();
QUndoStack *undoStack = fw->commandHistory();
if (severalChanges)
fw->beginCommand(QStringLiteral("Edit action"));
if (changeMask & ActionData::NameChanged)
undoStack->push(createTextPropertyCommand(QLatin1String(objectNamePropertyC), newActionData.name, action, fw));
if (changeMask & ActionData::TextChanged)
undoStack->push(createTextPropertyCommand(QLatin1String(textPropertyC), newActionData.text, action, fw));
if (changeMask & ActionData::ToolTipChanged)
undoStack->push(createTextPropertyCommand(QLatin1String(toolTipPropertyC), newActionData.toolTip, action, fw));
if (changeMask & ActionData::IconChanged)
undoStack->push(setIconPropertyCommand(newActionData.icon, action, fw));
if (changeMask & ActionData::CheckableChanged)
undoStack->push(setPropertyCommand(QLatin1String(checkablePropertyC), newActionData.checkable, false, action, fw));
if (changeMask & ActionData::KeysequenceChanged)
undoStack->push(setKeySequencePropertyCommand(newActionData.keysequence, action, fw));
if (severalChanges)
fw->endCommand();
}
示例5: buddy
static QString buddy(QLabel *label, QDesignerFormEditorInterface *core)
{
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), label);
if (sheet == 0)
return QString();
const int prop_idx = sheet->indexOf(QLatin1String(buddyPropertyC));
if (prop_idx == -1)
return QString();
return sheet->property(prop_idx).toString();
}
示例6: actionShortCut
// shortcut is a fake property, need to retrieve it via property sheet.
static QString actionShortCut(QDesignerFormEditorInterface *core, QAction *action)
{
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), action);
if (!sheet)
return QString();
const int index = sheet->indexOf(QLatin1String("shortcut"));
if (index == -1)
return QString();
const QKeySequence keysequence = qvariant_cast<QKeySequence>(sheet->property(index));
return keysequence.toString();
}
示例7: reloadPropertySheet
void QAxWidgetPropertySheet::reloadPropertySheet(const struct SavedProperties &properties, QDesignerFormWindowInterface *formWin)
{
QDesignerFormEditorInterface *core = formWin->core();
//Recreation of the property sheet
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension *>(core->extensionManager(), properties.widget);
bool foundGeometry = false;
const QString geometryProperty = QLatin1String(geometryPropertyC);
const SavedProperties::NamePropertyMap::const_iterator cend = properties.changedProperties.constEnd();
for (SavedProperties::NamePropertyMap::const_iterator i = properties.changedProperties.constBegin(); i != cend; ++i) {
const QString name = i.key();
const int index = sheet->indexOf(name);
if (index == -1)
continue;
// filter out geometry as this will resize the control
// to is default size even if it is attached to an layout
// but set the changed flag to work around preview bug...
if (name == geometryProperty) {
sheet->setChanged(index, true);
foundGeometry = true;
continue;
}
if (name == QLatin1String(controlPropertyName)) {
sheet->setChanged(index, !i.value().toString().isEmpty());
continue;
}
sheet->setChanged(index, true);
sheet->setProperty(index, i.value());
}
if (!foundGeometry) // Make sure geometry is always changed in Designer
sheet->setChanged(sheet->indexOf(geometryProperty), true);
if (core->propertyEditor()->object() == properties.widget) {
formWin->clearSelection(true);
formWin->selectWidget(properties.widget);
}
}
示例8: initHeaderProperties
void ItemViewPropertySheet::initHeaderProperties(QHeaderView *hv, const QString &prefix)
{
QDesignerPropertySheetExtension *headerSheet = d->m_propertySheet.value(hv);
Q_ASSERT(headerSheet);
const QString headerGroupS = QLatin1String(headerGroup);
foreach (const QString &realPropertyName, d->realPropertyNames()) {
const int headerIndex = headerSheet->indexOf(realPropertyName);
Q_ASSERT(headerIndex != -1);
const QVariant defaultValue = realPropertyName == QLatin1String(visibleProperty) ?
QVariant(true) : headerSheet->property(headerIndex);
const QString fakePropertyName = d->fakePropertyName(prefix, realPropertyName);
const int fakeIndex = createFakeProperty(fakePropertyName, defaultValue);
d->m_propertyIdMap.insert(fakeIndex, Property(headerSheet, headerIndex));
setAttribute(fakeIndex, true);
setPropertyGroup(fakeIndex, headerGroupS);
}
}
示例9: StyleSheetEditorDialog
// --- StyleSheetPropertyEditorDialog
StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
QDesignerFormWindowInterface *fw,
QWidget *widget):
StyleSheetEditorDialog(fw->core(), parent),
m_fw(fw),
m_widget(widget)
{
Q_ASSERT(m_fw != 0);
QPushButton *apply = buttonBox()->addButton(QDialogButtonBox::Apply);
QObject::connect(apply, SIGNAL(clicked()), this, SLOT(applyStyleSheet()));
QObject::connect(buttonBox(), SIGNAL(accepted()), this, SLOT(applyStyleSheet()));
QDesignerPropertySheetExtension *sheet =
qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget);
Q_ASSERT(sheet != 0);
setText(sheet->property(sheet->indexOf(QLatin1String(styleSheetProperty))).toString());
}
示例10: formGeometryChanged
void QtDesignerChild::formGeometryChanged()
{
// set modified state
bool loading = property( "loadingFile" ).toBool();
bool modified = !loading;
// update property
QDesignerPropertySheetExtension* sheet = qt_extension<QDesignerPropertySheetExtension*>( mDesignerManager->core()->extensionManager(), mHostWidget->formWindow() );
QRect geo = sheet->property( sheet->indexOf( "geometry" ) ).toRect();
geo.moveTopLeft( QPoint( 0, 0 ) );
delete sheet;
mDesignerManager->core()->propertyEditor()->setPropertyValue( "geometry", geo, modified );
// update state
mHostWidget->formWindow()->setDirty( modified );
setWindowModified( modified );
setProperty( "loadingFile", false );
// emit modified state
emit modifiedChanged( modified );
emit contentChanged();
}