VirtualBox

Changeset 90563 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 7, 2021 11:05:15 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Allow UINotificationCenter to have no parent and to be reparented.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.cpp

    r90562 r90563  
    123123
    124124/* static */
    125 void UINotificationCenter::create(QWidget *pParent)
     125void UINotificationCenter::create(QWidget *pParent /* = 0 */)
    126126{
    127127    AssertReturnVoid(!s_pInstance);
     
    140140{
    141141    return s_pInstance;
     142}
     143
     144void UINotificationCenter::setParent(QWidget *pParent)
     145{
     146    if (!pParent)
     147        hide();
     148    if (parent())
     149        parent()->removeEventFilter(this);
     150    QWidget::setParent(pParent);
     151    if (parent())
     152        parent()->installEventFilter(this);
     153    if (parent())
     154        show();
    142155}
    143156
     
    279292{
    280293    /* Listen for parent events: */
    281     parent()->installEventFilter(this);
     294    if (parent())
     295        parent()->installEventFilter(this);
    282296
    283297    /* Prepare the rest of stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h

    r90552 r90563  
    5555
    5656    /** Creates notification-center for passed @a pParent. */
    57     static void create(QWidget *pParent);
     57    static void create(QWidget *pParent = 0);
    5858    /** Destroys notification-center. */
    5959    static void destroy();
    6060    /** Returns notification-center singleton instance. */
    6161    static UINotificationCenter *instance();
     62
     63    /** Defines notification-center @a pParent. */
     64    void setParent(QWidget *pParent);
    6265
    6366    /** Invokes notification-center. */
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