QQmlEngine *Qt5NodeInstanceServer::engine() const
{
    if (quickView())
        return quickView()->engine();

    return 0;
}
void Qt5NodeInstanceServer::initializeView()
{
    Q_ASSERT(!quickView());

    m_quickView = new QQuickView;
    DesignerSupport::createOpenGLContext(m_quickView.data());
}
void Qt5NodeInstanceServer::setupScene(const CreateSceneCommand &command)
{
    setupFileUrl(command.fileUrl());
    setupImports(command.imports());
    setupDummyData(command.fileUrl());

    setupInstances(command);
    quickView()->resize(rootNodeInstance().boundingRect().size().toSize());
}
QList<ServerNodeInstance>  NodeInstanceServer::createInstances(const QVector<InstanceContainer> &containerVector)
{
    Q_ASSERT(declarativeView() || quickView());
    QList<ServerNodeInstance> instanceList;
    foreach (const InstanceContainer &instanceContainer, containerVector) {
        ServerNodeInstance instance;
        if (instanceContainer.nodeSourceType() == InstanceContainer::ComponentSource) {
            instance = ServerNodeInstance::create(this, instanceContainer, ServerNodeInstance::WrapAsComponent);
        } else {
            instance = ServerNodeInstance::create(this, instanceContainer, ServerNodeInstance::DoNotWrapAsComponent);
        }
        insertInstanceRelationship(instance);
        instanceList.append(instance);
        instance.internalObject()->installEventFilter(childrenChangeEventFilter());
        if (instanceContainer.instanceId() == 0) {
            m_rootNodeInstance = instance;
            if (quickView())
                quickView()->setContent(fileUrl(), m_importComponent, m_rootNodeInstance.rootQuickItem());
            resizeCanvasSizeToRootItemSize();
        }

        foreach (QQmlContext* context, allSubContextsForObject(instance.internalObject()))
            setupDummysForContext(context);
    }
Qt5NodeInstanceServer::~Qt5NodeInstanceServer()
{
    delete quickView();
}
FlyEmBodySplitProjectDialog::FlyEmBodySplitProjectDialog(QWidget *parent) :
  QDialog(parent),
  ui(new Ui::FlyEmBodySplitProjectDialog)
{
  ui->setupUi(this);

  m_loadBodyDlg = NULL;

  //connect(this, SIGNAL(accepted()), this, SLOT(clear()));
  connect(ui->view2dBodyPushButton, SIGNAL(clicked()),
          this, SLOT(showData2d()));
  connect(ui->view3dBodyPushButton, SIGNAL(clicked()),
          this, SLOT(showData3d()));
//  connect(ui->viewSplitPushButton,
//          SIGNAL(clicked()), this, SLOT(showResult3d()));
  connect(ui->viewResultQuickPushButton,
          SIGNAL(clicked()), this, SLOT(showResult3dQuick()));
  connect(ui->donePushButton, SIGNAL(clicked()), this, SLOT(clear()));
  connect(ui->loadBodyPushButton, SIGNAL(clicked()), this, SLOT(loadBody()));
  connect(ui->loadBookmarkButton, SIGNAL(clicked()),
          this, SLOT(loadBookmark()));
  /*
  connect(ui->bookmarkVisibleCheckBox, SIGNAL(toggled(bool)),
          &m_project, SLOT(showBookmark(bool)));
          */
  connect(ui->quickViewPushButton, SIGNAL(clicked()), this, SLOT(quickView()));
  connect(ui->fullGrayscaleCheckBox, SIGNAL(toggled(bool)),
          this, SLOT(viewFullGrayscale(bool)));
  connect(ui->updatePushButton, SIGNAL(clicked()),
          this, SLOT(viewFullGrayscale()));
  /*
  connect(ui->prevPushButton, SIGNAL(clicked()),
          this, SLOT(viewPreviousSlice()));
  connect(ui->nextPushButton, SIGNAL(clicked()),
          this, SLOT(viewNextSlice()));
  connect(ui->fullGrayscalePushButton, SIGNAL(clicked()),
          this, SLOT(viewFullGrayscale()));
          */
  connect(ui->saveSeedPushButton, SIGNAL(clicked()),
          this, SLOT(saveSeed()));

  ui->bookmarkView->setModel(&m_bookmarkList);

  updateWidget();

  m_project.setBookmarkVisible(ui->bookmarkVisibleCheckBox->isChecked());

  m_sideViewScene = new QGraphicsScene(this);
  //m_sideViewScene->setSceneRect(0, 0, ui->sideView->width(), ui->sideView->height());
  ui->sideView->setScene(m_sideViewScene);
//  ui->sideView->setFocus();

  setFocusPolicy(Qt::StrongFocus);
  //ui->outputWidget->setText("Load a body to start.");

#ifndef _DEBUG_
  ui->pushButton->hide();
#endif

  m_dvidDlg = ZDialogFactory::makeDvidDialog(this);

  createMenu();
  connectSignalSlot();

  m_messageManager = NULL;
}