本文整理汇总了C++中BrowserNode::is_writable方法的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNode::is_writable方法的具体用法?C++ BrowserNode::is_writable怎么用?C++ BrowserNode::is_writable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserNode
的用法示例。
在下文中一共展示了BrowserNode::is_writable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupExtraNodeController
void QuickEdit::SetupExtraNodeController()
{
extraNodeController = QSharedPointer<ItemController<BrowserNode> >( new ItemController<BrowserNode>());
extraNodeController->SetColumns(columns);
ADD_GETSET(BrowserExtraMember, extraNodeController, columns.indexOf("name"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString().toLatin1().constData, get_name, set_name);
ADD_GETSET(BrowserExtraMember, extraNodeController, columns.indexOf("deleted"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, deletedp, set_deleted);
ADD_PIXMAP_GETTER(BrowserExtraMember, extraNodeController, columns.indexOf("name"), QVector<int>({Qt::DecorationRole}), pixmap);
extraNodeController->AddFlagsFunctor
(
[&](const QModelIndex& index)
{
Qt::ItemFlags result;
result |= Qt::ItemIsSelectable;
if(!(index.column() *in(columns.indexOf("name"), columns.indexOf("deleted"))))
return result;
TreeItemInterface* iface = static_cast<TreeItemInterface*>(index.internalPointer());
if(!iface)
return result;
BrowserNode* pointer = static_cast<BrowserNode*>(iface->InternalPointer());
if(!pointer)
return result;
if(pointer->is_writable())
result |= Qt::ItemIsEditable;
result |= Qt::ItemIsEnabled;
return result;
}
);
}
示例2: return
BrowserNode * DeploymentNodeCanvas::new_type() {
BrowserNode * container = (BrowserNode *)
the_canvas()->browser_diagram()->parent();
return (container->is_writable())
? BrowserDeploymentNode::add_deploymentnode(container)
: 0;
}
示例3: SetupClassController
void QuickEdit::SetupClassController()
{
classController = QSharedPointer<ItemController<BrowserNode> >( new ItemController<BrowserNode>());
classController->SetColumns(columns);
ADD_GETSET(BrowserClass, classController, columns.indexOf("name"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_name, set_name);
ADD_GETSET(BrowserClass, classController, columns.indexOf("stereotype"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_stereotype, def->set_stereotype);
ADD_GETSET(BrowserClass, classController, columns.indexOf("deleted"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, deletedp, set_deleted);
ADD_GETSET_CONVERTED(BrowserClass, classController, columns.indexOf("visibility"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString,BrowserNode::encode_visibility,visibility_as_string, pointer->def->set_uml_visibility);
ADD_GETSET(BrowserClass, classController, columns.indexOf("abstract"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, def->get_is_abstract, def->set_is_abstract);
ADD_PIXMAP_GETTER(BrowserClass, classController, columns.indexOf("name"),QVector<int>({Qt::DecorationRole}), pixmap);
classController->AddFlagsFunctor
(
[&](const QModelIndex& index)
{
Qt::ItemFlags result;
result |= Qt::ItemIsSelectable;
if(!(index.column() *in(columns.indexOf("name"),columns.indexOf("stereotype"),columns.indexOf("visibility"),columns.indexOf("abstract"), columns.indexOf("deleted"))))
return result;
TreeItemInterface* iface = static_cast<TreeItemInterface*>(index.internalPointer());
if(!iface)
return result;
BrowserNode* pointer = static_cast<BrowserNode*>(iface->InternalPointer());
if(!pointer)
return result;
if(pointer->is_writable())
result |= Qt::ItemIsEditable;
result |= Qt::ItemIsEnabled;
return result;
}
);
}
示例4: TabDialog
ClassInstanceDialog::ClassInstanceDialog(ClassInstanceData * i)
: TabDialog(0, "class instance dialog", FALSE, Qt::WA_DeleteOnClose),
inst(i), atbl(0), rtbl(0)
{
setWindowTitle(tr("Class instance dialog"));
BrowserNode * bn = inst->get_browser_node();
bn->edit_start();
if (bn->is_writable()) {
setOkButton(tr("OK"));
setCancelButton(tr("Cancel"));
}
else {
setOkButton(QString());
setCancelButton(tr("Close"));
}
visit = !hasOkButton();
GridBox * grid;
// general tab
grid = new GridBox(2, this);
grid->setMargin(5);
grid->setSpacing(5);
grid->addWidget(new QLabel(tr("name : "), grid));
grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
if (visit)
edname->setReadOnly(TRUE);
grid->addWidget(new QLabel(tr("stereotype :"), grid));
grid->addWidget(edstereotype = new QComboBox( grid));
edstereotype->setEditable(!visit);
edstereotype->addItem(toUnicode(bn->get_stereotype()));
if (! visit) {
edstereotype->addItems(ProfiledStereotypes::defaults(UmlClassInstance));
edstereotype->setAutoCompletion(completion());
}
SmallPushButton * b;
grid->addWidget(b = new SmallPushButton(tr("class :"), grid));
connect(b, SIGNAL(clicked()), this, SLOT(menu_class()));
grid->addWidget(edtype = new QComboBox(grid));
if (visit) {
edtype->addItem(inst->get_class()->full_name());
nodes.append(inst->get_class());
}
else {
BrowserClass::instances(nodes);
nodes.full_names(list);
edtype->addItems(list);
edtype->setCurrentIndex(nodes.indexOf(inst->get_class()));
connect(edtype, SIGNAL(activated(int)), this, SLOT(type_changed(int)));
}
if (visit)
cl_container = 0;
else {
cl_container = (BrowserNode *) bn->parent();
if ((cl_container != 0) && !cl_container->is_writable())
cl_container = 0;
}
VVBox * vtab;
grid->addWidget(vtab = new VVBox(grid));
vtab->addWidget(new QLabel(tr("description :"), vtab));
if (! visit) {
connect(b =new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
this, SLOT(edit_description()));
vtab->addWidget(b);
}
grid->addWidget(comment = new MultiLineEdit(grid));
comment->setReadOnly(visit);
comment->setText(bn->get_comment());
QFont font = comment->font();
if (! hasCodec())
font.setFamily("Courier");
font.setFixedPitch(TRUE);
comment->setFont(font);
addTab(grid, "Uml");
// attributes tab
//.........这里部分代码省略.........
示例5: new_type_available
bool DeploymentNodeCanvas::new_type_available() {
BrowserNode * container = (BrowserNode *)
the_canvas()->browser_diagram()->parent();
return container->is_writable();
}
示例6: delete_internal
bool BrowserNode::delete_internal(QString & warning) {
if (deletedp())
return TRUE;
if (!is_writable() && !root_permission() && !is_from_lib()) {
warning += "\n " + TR("%1 is read-only", full_name());
return FALSE;
}
static Q3PtrList<BrowserNode> targetof;
static bool made = FALSE;
bool made_here;
if (!made) {
made = TRUE;
made_here = TRUE;
referenced_by(targetof, TRUE);
}
else
made_here = FALSE;
bool ro = FALSE;
if (!root_permission()) {
Q3PtrListIterator<BrowserNode> it(targetof);
BrowserNode * r;
while ((r = it.current()) != 0) {
if (!r->is_writable() && !r->is_from_lib()) {
ro = TRUE;
warning += "\n ";
switch (r->get_type()) {
case UmlComponent:
warning += TR("%1 referenced by the read-only component %2", full_name(), r->full_name());
break;
case UmlArtifact:
warning += TR("%1 referenced by the read-only artifact %2", full_name(), r->full_name());
break;
default:
warning += TR("%1 is the target of the read-only relation %2", full_name(), r->full_name());
break;
}
}
++it;
}
}
if (made_here) {
made = FALSE;
targetof.clear();
}
if (ro)
return FALSE;
// sub elts
Q3ListViewItem * child;
bool ok = TRUE;
for (child = firstChild(); child != 0; child = child->nextSibling())
ok &= ((BrowserNode *) child)->delete_internal(warning);
if (ok) {
is_deleted = TRUE;
if (is_marked) {
marked_list.removeRef(this);
is_marked = FALSE;
}
get_data()->delete_it();
repaint();
package_modified();
}
return ok;
}
示例7: SetupRelationController
void QuickEdit::SetupRelationController()
{
relationController = QSharedPointer<ItemController<BrowserNode> >( new ItemController<BrowserNode>());
relationController->SetColumns(columns);
ADD_GETSET(BrowserRelation, relationController, columns.indexOf("name"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_name, set_name);
ADD_GETSET_DIRECT(BrowserRelation, relationController, columns.indexOf("default"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, def->a.init_value.operator QString());
ADD_GETSET(BrowserRelation, relationController, columns.indexOf("deleted"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, deletedp, set_deleted);
std::function<void(RoleData& , UmlVisibility ) > f = [](RoleData& data, UmlVisibility vis){data.uml_visibility = vis;};
ADD_PIXMAP_GETTER(BrowserRelation, relationController, columns.indexOf("name"), QVector<int>({Qt::DecorationRole}), pixmap);
relationController->AddGetter(columns.indexOf("visibility"),QVector<int>({Qt::DisplayRole,Qt::EditRole}),
[] (const BrowserNode* data, const QModelIndex& index)
{
Q_UNUSED(index);
if(!data)
return QVariant();
const BrowserRelation* pointer = static_cast<const BrowserRelation*>(data);
if(pointer)
return QVariant(pointer->visibility_as_string());
else
return QVariant();
}
);
relationController->AddSetter(columns.indexOf("visibility"),QVector<int>({Qt::DisplayRole,Qt::EditRole}),
[] (BrowserNode* data, QVariant value, const QModelIndex& index)
{
Q_UNUSED(index);
if(!data)
return false;
BrowserRelation* pointer = static_cast<BrowserRelation*>(data);
if(pointer)
pointer->def->a.uml_visibility = BrowserNode::encode_visibility(value.toString());
pointer->modified();
return true;
}
);
ADD_GETSET_DIRECT(BrowserRelation, relationController, columns.indexOf("static"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, def->a.isa_class_relation);
ADD_GETSET_DIRECT(BrowserRelation, relationController, columns.indexOf("multiplicity"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, def->a.multiplicity.operator QString());
relationController->AddGetter(columns.indexOf("type"),QVector<int>({Qt::DisplayRole,Qt::EditRole}),
[] (const BrowserNode* data, const QModelIndex& )
{
if(!data)
return QVariant();
const BrowserRelation* pointer = static_cast<const BrowserRelation*>(data);
if(pointer)
return QVariant(pointer->def->get_end_class()->get_name());
else
return QVariant();
}
);
relationController->AddSetter(1,QVector<int>({Qt::DisplayRole,Qt::EditRole}),
[] (BrowserNode* data, QVariant value, const QModelIndex& )
{
if(!data)
return false;
BrowserRelation* pointer = static_cast<BrowserRelation*>(data);
if(pointer)
pointer->def->get_end_class()->set_name(value.toString());
pointer->modified();
return true;
});
relationController->AddFlagsFunctor
(
[&](const QModelIndex& index)
{
Qt::ItemFlags result;
result |= Qt::ItemIsSelectable;
if(!(index.column() *in(columns.indexOf("name"),columns.indexOf("type"),columns.indexOf("default"),columns.indexOf("visibility"), columns.indexOf("deleted"))))
return result;
TreeItemInterface* iface = static_cast<TreeItemInterface*>(index.internalPointer());
if(!iface)
return result;
BrowserNode* pointer = static_cast<BrowserNode*>(iface->InternalPointer());
if(!pointer)
return result;
if(pointer->is_writable() && (index.column() *in(columns.indexOf("name"),columns.indexOf("default"),columns.indexOf("visibility"))))
result |= Qt::ItemIsEditable;
result |= Qt::ItemIsEnabled ;
return result;
}
);
}
示例8: SetupAttributeController
void QuickEdit::SetupAttributeController()
{
attributeController = QSharedPointer<ItemController<BrowserNode> >( new ItemController<BrowserNode>());
attributeController->SetColumns(columns);
ADD_GETSET(BrowserAttribute, attributeController, columns.indexOf("name"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_name, set_name);
ADD_GETSET_DATA(BrowserAttribute, AttributeData, attributeController, columns.indexOf("type"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_type().get_type, set_type);
ADD_GETSET_DATA(BrowserAttribute, AttributeData, attributeController, columns.indexOf("default_value"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_init_value, set_init_value);
ADD_GETSET(BrowserAttribute, attributeController, columns.indexOf("stereotype"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString, get_stereotype, def->set_stereotype);
ADD_GETSET(BrowserAttribute, attributeController, columns.indexOf("deleted"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, deletedp, set_deleted);
// ADD_GETSET_DIRECT_ASSIGNMENT(BrowserAttribute, attributeController, columns.indexOf("visibility"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
// visibility_as_string(), BrowserNode::encode_visibility(value.toString()));
ADD_GETSET_CONVERTED(BrowserAttribute, attributeController, columns.indexOf("visibility"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString,BrowserNode::encode_visibility,visibility_as_string, pointer->def->set_visibility);
ADD_GETSET_DATA(BrowserAttribute, AttributeData, attributeController, columns.indexOf("static"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool,get_isa_class_attribute, set_isa_class_attribute);
ADD_PIXMAP_GETTER(BrowserAttribute, attributeController, columns.indexOf("name"), QVector<int>({Qt::DecorationRole}), pixmap);
attributeController->AddFlagsFunctor
(
[&](const QModelIndex& index)
{
Qt::ItemFlags result;
result |= Qt::ItemIsSelectable;
if(!(index.column() *in(columns.indexOf("name"),columns.indexOf("type"),columns.indexOf("default_value"),columns.indexOf("stereotype"),
columns.indexOf("visibility"), columns.indexOf("static"), columns.indexOf("deleted"))))
return result;
TreeItemInterface* iface = static_cast<TreeItemInterface*>(index.internalPointer());
if(!iface)
return result;
BrowserNode* pointer = static_cast<BrowserNode*>(iface->InternalPointer());
if(!pointer)
return result;
if(pointer->is_writable())
result |= Qt::ItemIsEditable;
result |= Qt::ItemIsEnabled ;
return result;
}
);
std::function<void(BrowserNode*,const QModelIndex& index)> f = [](BrowserNode* node ,const QModelIndex& index)
{
Q_UNUSED(index);
BrowserAttribute* attr = static_cast<BrowserAttribute*>(node);
attr->modified();
attr->setText(0,attr->get_name() );
attr->package_modified();
attr->get_data()->modified();
};
attributeController->AddPostProcessors(columns.indexOf("name"), QVector<int>(QVector<int>({Qt::DisplayRole,Qt::EditRole})),f);
}