本文整理汇总了C++中PropertyItem::isReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyItem::isReadOnly方法的具体用法?C++ PropertyItem::isReadOnly怎么用?C++ PropertyItem::isReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyItem
的用法示例。
在下文中一共展示了PropertyItem::isReadOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flags
Qt::ItemFlags PropertyModel::flags(const QModelIndex & index) const
{
if (!index.isValid())
return 0;
PropertyItem * item = retrieveItem(index);
Qt::ItemFlags flags = Qt::ItemIsSelectable;
if (index.column() == 1 && item->property()->isValue() && !item->isReadOnly())
flags |= Qt::ItemIsEditable;
if (item->isEnabled())
flags |= Qt::ItemIsEnabled;
return flags;
}
示例2: if
QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & /*option*/,
const QModelIndex & index ) const
{
if (!index.isValid())
return 0;
PropertyItem *childItem = static_cast<PropertyItem*>(index.internalPointer());
if (!childItem)
return 0;
QWidget* editor = childItem->createEditor(parent, this, SLOT(valueChanged()));
if (editor) // Make sure the editor background is painted so the cell content doesn't show through
editor->setAutoFillBackground(true);
if (editor && childItem->isReadOnly())
editor->setDisabled(true);
else if (editor && this->pressed)
editor->setFocus();
this->pressed = false;
return editor;
}
示例3: if
QWidget * PropertyItemDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & /*option*/,
const QModelIndex & index ) const
{
if (!index.isValid())
return 0;
PropertyItem *childItem = static_cast<PropertyItem*>(index.internalPointer());
if (!childItem)
return 0;
QWidget* editor = childItem->createEditor(parent, this, SLOT(valueChanged()));
if (editor) // Make sure the editor background is painted so the cell content doesn't show through
editor->setAutoFillBackground(true);
if (editor && childItem->isReadOnly())
editor->setDisabled(true);
else if (editor /*&& this->pressed*/) {
// We changed the way editor is activated in PropertyEditor (in response
// of signal activated and clicked), so now we should grab focus
// regardless of "pressed" or not (e.g. when activated by keyboard
// enter)
editor->setFocus();
}
this->pressed = false;
return editor;
}