void NavBarPlugin::currentIndexChanged(int index)
{
    Q_UNUSED(index);
    NavBar *widget = qobject_cast<NavBar*>(sender());

    if (widget)
    {
        QDesignerFormWindowInterface *form = QDesignerFormWindowInterface::findFormWindow(widget);

        if (form)
            form->emitSelectionChanged();
    }
}
bool DsgnOfficeStyleWidget::event(QEvent* event)
{
    bool res = QWidget::event(event);
    if (event->type() == QEvent::ParentChange)
    {
        if (DsgnOfficeStyle* desStyle = dynamic_cast<DsgnOfficeStyle *>(m_targetStyle))
            desStyle->setParentStyle(parentWidget());
    }
    else if (event->type() == QEvent::Hide && isHidden())
    {
        QDesignerFormWindowInterface* formWindow = QDesignerFormWindowInterface::findFormWindow(parentWidget());
        QDesignerFormEditorInterface* core = formWindow->core();
        QDesignerContainerExtension* container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), formWindow->mainContainer());

        if (container->widget(container->count() - 1) == this)
        {
            container->remove(container->count() - 1);
            core->metaDataBase()->remove(this);
            formWindow->emitSelectionChanged();
        }
    }
    return res;
}