コード例 #1
0
ファイル: DlgFilletEdges.cpp プロジェクト: lainegates/FreeCAD
void DlgFilletEdges::setupFillet(const std::vector<App::DocumentObject*>& objs)
{
    App::DocumentObject* base = d->fillet->Base.getValue();
    const std::vector<Part::FilletElement>& e = d->fillet->Edges.getValues();
    std::vector<App::DocumentObject*>::const_iterator it = std::find(objs.begin(), objs.end(), base);
    if (it != objs.end()) {
        // toggle visibility
        Gui::ViewProvider* vp;
        vp = Gui::Application::Instance->getViewProvider(d->fillet);
        if (vp) vp->hide();
        vp = Gui::Application::Instance->getViewProvider(base);
        if (vp) vp->show();

        int current_index = (it - objs.begin()) + 1;
        ui->shapeObject->setCurrentIndex(current_index);
        on_shapeObject_activated(current_index);
        ui->shapeObject->setEnabled(false);
        QStandardItemModel *model = qobject_cast<QStandardItemModel*>(ui->treeView->model());
        for (std::vector<Part::FilletElement>::const_iterator et = e.begin(); et != e.end(); ++et) {
            std::vector<int>::iterator it = std::find(d->edge_ids.begin(), d->edge_ids.end(), et->edgeid);
            if (it != d->edge_ids.end()) {
                int index = it - d->edge_ids.begin();
                model->setData(model->index(index, 0), Qt::Checked, Qt::CheckStateRole);
                model->setData(model->index(index, 1), QVariant(QLocale::system().toString(et->radius1,'f',2)));
                model->setData(model->index(index, 2), QVariant(QLocale::system().toString(et->radius2,'f',2)));
            }
        }
    }
}
コード例 #2
0
void MergeDocuments::importObject(const std::vector<App::DocumentObject*>& o, Base::XMLReader & r)
{
    objects = o;
    for (std::vector<App::DocumentObject*>::iterator it = objects.begin(); it != objects.end(); ++it) {
        Gui::ViewProvider* vp = document->getViewProvider(*it);
        if (vp) vp->hide();
    }
    Restore(r);

    r.readFiles(*this->stream);
}
コード例 #3
0
ファイル: DrawingView.cpp プロジェクト: 5263/FreeCAD
void DrawingView::closeEvent(QCloseEvent* ev)
{
    MDIView::closeEvent(ev);
    if (!ev->isAccepted())
        return;

    // when closing the view from GUI notify the view provider to mark it invisible
    if (_pcDocument && !m_objectName.empty()) {
        App::Document* doc = _pcDocument->getDocument();
        if (doc) {
            App::DocumentObject* obj = doc->getObject(m_objectName.c_str());
            Gui::ViewProvider* vp = _pcDocument->getViewProvider(obj);
            if (vp)
                vp->hide();
        }
    }
}