本文整理汇总了C++中QDesignerPropertySheetExtension::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QDesignerPropertySheetExtension::property方法的具体用法?C++ QDesignerPropertySheetExtension::property怎么用?C++ QDesignerPropertySheetExtension::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDesignerPropertySheetExtension
的用法示例。
在下文中一共展示了QDesignerPropertySheetExtension::property方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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);
}
}
示例5: 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());
}
示例6: 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();
}