VirtualBox

Ignore:
Timestamp:
Aug 5, 2020 10:14:37 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9609: Few action-pool fixes: Extending menu-actions with possibility to be constructed with full icon; Check for a null passed icon or names in missed places.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp

    r85572 r85610  
    244244
    245245UIActionMenu::UIActionMenu(UIActionPool *pParent,
     246                           const QString &strIconNormal, const QString &strIconSmall,
     247                           const QString &strIconNormalDisabled, const QString &strIconSmallDisabled)
     248    : UIAction(pParent, UIActionType_Menu)
     249{
     250    if (!strIconNormal.isNull())
     251        setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
     252    prepare();
     253}
     254
     255UIActionMenu::UIActionMenu(UIActionPool *pParent,
    246256                           const QIcon &icon)
    247257    : UIAction(pParent, UIActionType_Menu)
     
    290300    : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
    291301{
    292     setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
     302    if (!strIcon.isNull())
     303        setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
    293304}
    294305
     
    299310    : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
    300311{
    301     setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
     312    if (!strIconNormal.isNull())
     313        setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
    302314}
    303315
     
    307319    : UIAction(pParent, UIActionType_Simple, fMachineMenuAction)
    308320{
    309     setIcon(icon);
     321    if (!icon.isNull())
     322        setIcon(icon);
    310323}
    311324
     
    327340    : UIAction(pParent, UIActionType_Toggle, fMachineMenuAction)
    328341{
    329     setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
     342    if (!strIcon.isNull())
     343        setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
    330344    prepare();
    331345}
     
    337351    : UIAction(pParent, UIActionType_Toggle, fMachineMenuAction)
    338352{
    339     setIcon(UIIconPool::iconSetOnOff(strIconOn, strIconOff, strIconOnDisabled, strIconOffDisabled));
     353    if (!strIconOn.isNull())
     354        setIcon(UIIconPool::iconSetOnOff(strIconOn, strIconOff, strIconOnDisabled, strIconOffDisabled));
    340355    prepare();
    341356}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r85572 r85610  
    324324                 const QString &strIconDisabled = QString());
    325325    /** Constructs menu action passing @a pParent to the base-class.
     326      * @param  strIconNormal          Brings the normal-icon name.
     327      * @param  strIconSmall           Brings the small-icon name.
     328      * @param  strIconNormalDisabled  Brings the normal-disabled-icon name.
     329      * @param  strIconSmallDisabled   Brings the small-disabled-icon name. */
     330    UIActionMenu(UIActionPool *pParent,
     331                 const QString &strIconNormal, const QString &strIconSmall,
     332                 const QString &strIconNormalDisabled, const QString &strIconSmallDisabled);
     333    /** Constructs menu action passing @a pParent to the base-class.
    326334      * @param  icon  Brings the icon. */
    327335    UIActionMenu(UIActionPool *pParent,
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