VirtualBox

Ignore:
Timestamp:
Aug 5, 2024 2:09:31 PM (7 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164260
Message:

FE/Qt: bugref:10665: UINativeWizard: Make sure wizard is cleanup up if aborted (by Escape key or Cancel button).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.cpp

    r105582 r105583  
    55
    66/*
    7  * Copyright (C) 2009-2023 Oracle and/or its affiliates.
     7 * Copyright (C) 2009-2024 Oracle and/or its affiliates.
    88 *
    99 * This file is part of VirtualBox base platform packages, as
     
    9999    , m_strHelpKeyword(strHelpKeyword)
    100100    , m_iLastIndex(-1)
     101    , m_fAborted(false)
    101102    , m_fClosed(false)
    102103    , m_pLabelPixmap(0)
     
    234235void UINativeWizard::keyPressEvent(QKeyEvent *pEvent)
    235236{
     237    // WORKAROUND:
     238    // In non-modal case we'll have to handle Escape button ourselves.
     239    // In modal case QDialog does this itself internally by unwinding the event-loop.
     240
    236241    /* Different handling depending on current modality: */
    237242    const Qt::WindowModality enmModality = windowHandle()->modality();
     
    245250            case Qt::Key_Escape:
    246251            {
    247                 close();
     252                sltAbort();
    248253                return;
    249254            }
     
    276281        {
    277282            m_fClosed = true;
     283            if (m_fAborted)
     284                cleanWizard();
    278285            emit sigClose(m_enmType);
    279286        }
     
    378385            accept();
    379386    }
     387}
     388
     389void UINativeWizard::sltAbort()
     390{
     391    cleanWizard();
     392    close();
    380393}
    381394
     
    539552                        this, &UINativeWizard::sltNext);
    540553                connect(wizardButton(WizardButtonType_Cancel), &QPushButton::clicked,
    541                         this, &UINativeWizard::close);
     554                        this, &UINativeWizard::sltAbort);
    542555            }
    543556
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UINativeWizard.h

    r105582 r105583  
    55
    66/*
    7  * Copyright (C) 2009-2023 Oracle and/or its affiliates.
     7 * Copyright (C) 2009-2024 Oracle and/or its affiliates.
    88 *
    99 * This file is part of VirtualBox base platform packages, as
     
    155155
    156156protected slots:
     157
    157158    /** Handles translation event. */
    158159    virtual void sltRetranslateUI();
     
    169170    /** Switches to next page. */
    170171    void sltNext();
     172    /** Aborts wizard. */
     173    void sltAbort();
    171174
    172175    /** Handle help request*/
     
    210213    /** Holds the set of invisible pages. */
    211214    QSet<int>   m_invisiblePages;
     215    /** Holds whether user has requested to abort wizard. */
     216    bool        m_fAborted;
    212217    /** Holds whether the dialod had emitted signal to be closed. */
    213218    bool        m_fClosed;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette