本文整理汇总了C++中QDesignerFormWindowInterface::unmanageWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QDesignerFormWindowInterface::unmanageWidget方法的具体用法?C++ QDesignerFormWindowInterface::unmanageWidget怎么用?C++ QDesignerFormWindowInterface::unmanageWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDesignerFormWindowInterface
的用法示例。
在下文中一共展示了QDesignerFormWindowInterface::unmanageWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: widgetManaged
void DsgnRibbonStatusBarPlugin::widgetManaged(QWidget* widget)
{
if (widget->metaObject()->className() == QString("Qtitan::RibbonStatusBar"))
{
QDesignerFormWindowInterface* formWindow = static_cast<QDesignerFormWindowInterface *>(sender());
QDesignerFormEditorInterface* core = formWindow->core();
QDesignerContainerExtension* container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), formWindow->mainContainer());
formWindow->unmanageWidget(widget);
QUndoStack* stack = formWindow->commandHistory();
if (!stack->isClean())
{
//This code check the InsertWidget command on the stack.
const QUndoCommand* command = stack->command(stack->index());
if (command->childCount() == 0)
return;
}
if (qobject_cast<QMainWindow *>(formWindow->mainContainer()) == 0)
{
QMessageBox::critical(
formWindow->mainContainer(),
tr("Can't add Ribbon StatusBar"),
tr("You can add Ribbon StatusBar onto Qtitan::RibbonMainWindow or QMainWindow only."));
widget->deleteLater();
return;
}
for (int i = 0; i < container->count(); ++i)
{
QWidget* w = container->widget(i);
if (w->metaObject()->className() == QString("Qtitan::RibbonStatusBar") ||
w->metaObject()->className() == QString("QStatusBar"))
{
QMessageBox::critical(
formWindow->mainContainer(),
tr("Can't add Ribbon StatusBar"),
tr("Only one instance of the Ribbon StatusBar can be adding to the main form."));
widget->deleteLater();
return;
}
}
container->addWidget(widget);
formWindow->core()->metaDataBase()->add(widget);
}
}
示例2: widgetManaged
void RibbonStyleDsgnPlugin::widgetManaged(QWidget* widget)
{
QDesignerFormWindowInterface* formWindow = static_cast<QDesignerFormWindowInterface *>(sender());
QDesignerFormEditorInterface* core = formWindow->core();
QDesignerContainerExtension* container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), formWindow->mainContainer());
if (widget->metaObject()->className() == QString("Qtitan::RibbonStyle"))
{
formWindow->unmanageWidget(widget);
QUndoStack* stack = formWindow->commandHistory();
if (!stack->isClean())
{
//This code check the InsertWidget command on the stack.
const QUndoCommand* command = stack->command(stack->index());
if (command->childCount() == 0)
return;
}
if (qobject_cast<QMainWindow *>(formWindow->mainContainer()) == 0)
{
QMessageBox::critical(formWindow->mainContainer(), tr("Can't add Ribbon Style"),
tr("You can't drag-drop the style to this QWidget form. The style can be placed only onto the form of QMainWindow successor."));
widget->deleteLater();
return;
}
QWidget* widgetStyle = Q_NULL;
for (int i = 0; i < container->count() && widgetStyle == Q_NULL; ++i)
{
QWidget* w = container->widget(i);
if (w->metaObject()->className() == QString("Qtitan::OfficeStyle") ||
w->metaObject()->className() == QString("Qtitan::RibbonStyle"))
widgetStyle = w;
}
if (widgetStyle && widgetStyle->metaObject()->className() == QString("Qtitan::RibbonStyle"))
{
QMessageBox::critical(
formWindow->mainContainer(),
tr("Can't add Ribbon Style"),
tr("Only one instance of the Ribbon Style can be adding to the main form."));
widget->deleteLater();
return;
}
if (widgetStyle)
{
g_removeBlock = true;
const QString description = tr("Delete '%1'").arg(widgetStyle->objectName());
formWindow->commandHistory()->beginMacro(description);
DeleteStyleCommand* cmd = new DeleteStyleCommand(formWindow);
cmd->init(widgetStyle);
formWindow->commandHistory()->push(cmd);
formWindow->commandHistory()->endMacro();
g_removeBlock = false;
}
container->addWidget(widget);
formWindow->core()->metaDataBase()->add(widget);
widget->setCursor(Qt::PointingHandCursor);
}
else if (DesignerMainWindowStyleContainer* styelContainer = dynamic_cast<DesignerMainWindowStyleContainer*>(container))
{
if (QMainWindow* mainindow = static_cast<QMainWindow*>(styelContainer->mainWindow()))
{
if (Qtitan::CommonStyle* currentStyle = qobject_cast<Qtitan::CommonStyle*>(mainindow->style()))
::setChildStyle(widget, currentStyle);
}
}
}