VirtualBox

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


Ignore:
Timestamp:
Nov 26, 2009 2:24:29 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
55309
Message:

FE/Qt4-OSX: Fix various focus & background color problems for some of the editor items in the appliance dialog on Cocoa.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxApplianceEditorWgt.h

    r19149 r25001  
    211211        return size;
    212212    }
     213
     214protected:
     215#ifdef QT_MAC_USE_COCOA
     216    bool eventFilter (QObject *aObject, QEvent *aEvent);
     217#endif /* QT_MAC_USE_COCOA */
     218
    213219private:
    214220    /* Private member vars */
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxOSTypeSelectorButton.h

    r16736 r25001  
    2424#define __VBoxOSTypeSelectorButton_h__
    2525
     26/* VBox includes */
    2627#include "QIWithRetranslateUI.h"
    2728
     29/* Qt includes */
    2830#include <QPushButton>
    2931
     
    3840    QString osTypeId() const { return mOSTypeId; }
    3941
     42    bool isMenuShown() const;
     43
    4044    void retranslateUi();
    4145
     
    4650    void populateMenu();
    4751
     52    /* Private member vars */
    4853    QString mOSTypeId;
    4954    QMenu *mMainMenu;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxApplianceEditorWgt.cpp

    r24766 r25001  
    357357                     * the button hasn't a rectangle shape. This prevents the
    358358                     * display of parts from the current text on the Mac. */
     359#ifdef QT_MAC_USE_COCOA
     360                    /* Use the palette from the tree view, not the one from the
     361                     * editor. */
     362                    QPalette p = e->palette();
     363                    p.setBrush (QPalette::Highlight, aParent->palette().brush (QPalette::Highlight));
     364                    e->setPalette(p);
     365#endif /* QT_MAC_USE_COCOA */
    359366                    e->setAutoFillBackground (true);
    360367                    e->setBackgroundRole (QPalette::Highlight);
     
    890897        aEditor->setGeometry (aOption.rect);
    891898}
     899
     900#ifdef QT_MAC_USE_COCOA
     901bool VirtualSystemDelegate::eventFilter (QObject *aObject, QEvent *aEvent)
     902{
     903    if (aEvent->type() == QEvent::FocusOut)
     904    {
     905        /* On Mac OS X Cocoa the OS type selector widget loses it focus when
     906         * the popup menu is shown. Prevent this here, cause otherwise the new
     907         * selected OS will not be updated. */
     908        VBoxOSTypeSelectorButton *button = qobject_cast<VBoxOSTypeSelectorButton*> (aObject);
     909        if (button && button->isMenuShown())
     910            return false;
     911        /* The same counts for the text edit buttons of the license or
     912         * description fields. */
     913        else if (qobject_cast<VBoxLineTextEdit*> (aObject))
     914            return false;
     915    }
     916
     917    return QItemDelegate::eventFilter (aObject, aEvent);
     918}
     919#endif /* QT_MAC_USE_COCOA */
    892920
    893921////////////////////////////////////////////////////////////////////////////////
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxOSTypeSelectorButton.cpp

    r16736 r25001  
    2121 */
    2222
     23/* VBox includes */
    2324#include "VBoxOSTypeSelectorButton.h"
    2425#include "VBoxGlobal.h"
    2526
     27/* Qt includes */
    2628#include <QMenu>
    2729#include <QSignalMapper>
     
    5658}
    5759
     60bool VBoxOSTypeSelectorButton::isMenuShown() const
     61{
     62    return mMainMenu->isVisible();
     63}
     64
    5865void VBoxOSTypeSelectorButton::retranslateUi()
    5966{
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