本文整理汇总了C++中Messagebox::result方法的典型用法代码示例。如果您正苦于以下问题:C++ Messagebox::result方法的具体用法?C++ Messagebox::result怎么用?C++ Messagebox::result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messagebox
的用法示例。
在下文中一共展示了Messagebox::result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disableObjectSQL
void disableObjectSQL(BaseObject *object, bool disable)
{
if(object && object->getObjectType()!=BASE_RELATIONSHIP)
{
Messagebox msgbox;
ObjectType obj_type=object->getObjectType();
bool curr_val=object->isSQLDisabled();
if(object->isSystemObject())
throw Exception(Exception::getErrorMessage(ERR_OPR_RESERVED_OBJECT)
.arg(object->getName(true))
.arg(object->getTypeName()),
ERR_OPR_RESERVED_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__);
object->setSQLDisabled(disable);
if(obj_type!=OBJ_DATABASE && curr_val!=disable)
{
msgbox.show(QString(QT_TR_NOOP("Do you want to apply the <strong>SQL %1 status</strong> to the object's references too? This will avoid problems when exporting or validating the model.")).arg(disable ? QT_TR_NOOP("disabling") : QT_TR_NOOP("enabling")),
Messagebox::CONFIRM_ICON, Messagebox::YES_NO_BUTTONS);
if(msgbox.result()==QDialog::Accepted)
disableReferencesSQL(object);
}
/* Special case for tables. When disable the code there is the need to disable constraints
codes when the code of parent table is disabled too in order to avoid export errors */
if(object->getObjectType()==OBJ_TABLE)
{
Constraint *constr = nullptr;
vector<TableObject *> *objects=dynamic_cast<Table *>(object)->getObjectList(OBJ_CONSTRAINT);
for(auto &obj : (*objects))
{
constr=dynamic_cast<Constraint *>(obj);
/* If the constraint is not FK but is declared outside table via alter (ALTER TABLE...ADD CONSTRAINT...) or
The constraint is FK and the reference table is disabled the FK will not be enabled */
if((constr->getConstraintType()!=ConstraintType::foreign_key && !constr->isDeclaredInTable()) ||
(constr->getConstraintType()==ConstraintType::foreign_key &&
(disable || (!disable && !constr->getReferencedTable()->isSQLDisabled()))))
constr->setSQLDisabled(disable);
}
}
}
}