コード例 #1
0
/**
 * closes this MDI window.
 *
 * @param force Disable cancel button (demo versions)
 * @param ask Ask user before closing.
 */
bool QC_MDIWindow::closeMDI(bool force, bool ask) {
    // should never happen:
    if (document==NULL) {
        return true;
    }

    bool ret = false;

    bool isBlock = (parentWindow!=NULL);

    // This is a block and we don't need to ask the user for closing
    //   since it's still available in the parent drawing after closing.
    if (isBlock) {
        RS_DEBUG->print("  closing block");
        // tell parent window we're not here anymore.
        if (parentWindow!=NULL) {
            RS_DEBUG->print("    notifying parent about closing this window");
            parentWindow->removeChildWindow(this);
        }
        emit(signalClosing());
        ret = true;
    }

    // This is a graphic document. ask user for closing.
    else if (!ask || slotFileClose(force)) {
        RS_DEBUG->print("  closing graphic");
        // close all child windows:
        bool done;
        do {
            done=true;
            if (childWindows.at(0)!=NULL) {
                childWindows.at(0)->close();
                done=false;
            }
        } while (!done);

        emit(signalClosing());

        ret = true;
    }

    // User decided not to close graphic document:
    else {
        ret = false;
    }

    return (ret || force);
}
コード例 #2
0
ファイル: qc_mdiwindow.cpp プロジェクト: LibreCAD/LibreCAD
/**
 * closes this MDI window.
 *
 * @param force Disable cancel button (demo versions)
 * @param ask Ask user before closing.
 */
bool QC_MDIWindow::closeMDI(bool force, bool ask)
{
    RS_DEBUG->print("QC_MDIWindow::closeMDI begin");
    // should never happen:
    if (document==NULL) {
        return true;
    }

    bool ret = false;

    // This is a block and we don't need to ask the user for closing
    //   since it's still available in the parent drawing after closing.
    if (parentWindow)
    {
        RS_DEBUG->print("  closing block");
        RS_DEBUG->print("  notifying parent about closing this window");
        parentWindow->removeChildWindow(this);
        emit(signalClosing(this));
        ret = true;
    }

    // This is a graphic document. ask user for closing.
    else if (!ask || slotFileClose(force)) {
        RS_DEBUG->print("  closing graphic");

        emit(signalClosing(this));

        if (childWindows.length() > 0)
        {
            for(auto p: childWindows)
            {
                cadMdiArea->removeSubWindow(p);
                p->close();
            }
		childWindows.clear();
        }

        ret = true;
    }

    // User decided not to close graphic document:
    else {
        ret = false;
    }

    return (ret || force);
}
コード例 #3
0
ファイル: RenderView.cpp プロジェクト: kateyy/geohazardvis
RenderView::~RenderView()
{
    signalClosing();

    QList<AbstractVisualizedData *> toDelete;

    for (auto & rendered : m_contents)
    {
        toDelete << rendered.get();
    }

    for (auto & rendered : m_contentCache)
    {
        toDelete << rendered.get();
    }

    emit beforeDeleteVisualizations(toDelete);
}