VirtualBox

Changeset 108125 in vbox for trunk


Ignore:
Timestamp:
Feb 9, 2025 6:03:50 PM (3 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167424
Message:

FE/Qt: bugref:10814: VBox Manager / Tools pane: Wipe out extra-button code for now.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp

    r108124 r108125  
    187187
    188188UIToolsItem::UIToolsItem(QGraphicsScene *pScene, const QIcon &icon,
    189                          UIToolClass enmClass, UIToolType enmType,
    190                          bool fExtraButton /* = false */)
     189                         UIToolClass enmClass, UIToolType enmType)
    191190    : m_pScene(pScene)
    192191    , m_icon(icon)
    193192    , m_enmClass(enmClass)
    194193    , m_enmType(enmType)
    195     , m_fExtraButton(fExtraButton)
    196194    , m_fHovered(false)
    197195    , m_pHoveringMachine(0)
     
    402400    /* Paint tool info: */
    403401    paintToolInfo(pPainter, rectangle);
    404     /* Paint extra-button if requested: */
    405     if (   m_fExtraButton
    406         && model()->isAtLeastOneItemHovered())
    407         paintExtraButton(pPainter, rectangle);
    408402}
    409403
     
    578572        case ToolsItemData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    579573        case ToolsItemData_Padding: return 4;
    580         case ToolsItemData_ExtraButtonWidth: return 10;
    581574
    582575        /* Default: */
     
    935928}
    936929
    937 void UIToolsItem::paintExtraButton(QPainter *pPainter, const QRect &rectangle) const
    938 {
    939     /* Prepare variables: */
    940     const int iPadding = data(ToolsItemData_Padding).toInt();
    941     const int iButtonWidth = data(ToolsItemData_ExtraButtonWidth).toInt();
    942 
    943     /* Save painter: */
    944     pPainter->save();
    945 
    946     /* Configure painter: */
    947     pPainter->setRenderHint(QPainter::Antialiasing, true);
    948     /* Acquire background color: */
    949     const QPalette pal = QApplication::palette();
    950 #ifdef VBOX_WS_MAC
    951     const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Window);
    952 #else /* !VBOX_WS_MAC */
    953     const QColor windowColor = pal.color(QPalette::Active, QPalette::Window);
    954     const QColor accentColor = pal.color(QPalette::Active, QPalette::Accent);
    955     const int iRed = iShift30(windowColor.red(), accentColor.red());
    956     const int iGreen = iShift30(windowColor.green(), accentColor.green());
    957     const int iBlue = iShift30(windowColor.blue(), accentColor.blue());
    958     const QColor backgroundColor = QColor(qRgb(iRed, iGreen, iBlue));
    959 #endif /* !VBOX_WS_MAC */
    960 
    961     /* Prepare button sub-rect: */
    962     m_extraButtonRect.setWidth(iButtonWidth);
    963     m_extraButtonRect.setHeight(rectangle.height() / 2);
    964     m_extraButtonRect.moveTopLeft(QPoint(rectangle.right() - m_extraButtonRect.width() - 2,
    965                                          rectangle.bottom() - 3 * rectangle.height() / 4 + 1));
    966 
    967     /* Paint button frame: */
    968     QPainterPath painterPath;
    969     painterPath.addRoundedRect(m_extraButtonRect, iPadding, iPadding);
    970 #ifdef VBOX_WS_MAC
    971     const QColor backgroundColor1 = uiCommon().isInDarkMode()
    972                                   ? backgroundColor.lighter(220)
    973                                   : backgroundColor.darker(140);
    974 #else /* !VBOX_WS_MAC */
    975     const QColor backgroundColor1 = uiCommon().isInDarkMode()
    976                                   ? backgroundColor.lighter(140)
    977                                   : backgroundColor.darker(120);
    978 #endif /* !VBOX_WS_MAC */
    979     pPainter->setPen(QPen(backgroundColor1, 2, Qt::SolidLine, Qt::RoundCap));
    980     pPainter->drawPath(QPainterPathStroker().createStroke(painterPath));
    981 
    982     /* Fill button body: */
    983     pPainter->setClipPath(painterPath);
    984 #ifdef VBOX_WS_MAC
    985     const QColor backgroundColor2 = uiCommon().isInDarkMode()
    986                                   ? backgroundColor.lighter(160)
    987                                   : backgroundColor.darker(120);
    988 #else /* !VBOX_WS_MAC */
    989     const QColor backgroundColor2 = uiCommon().isInDarkMode()
    990                                   ? backgroundColor.lighter(105)
    991                                   : backgroundColor.darker(105);
    992 #endif /* !VBOX_WS_MAC */
    993     pPainter->fillRect(m_extraButtonRect, backgroundColor2);
    994 
    995     /* Paint arrow: */
    996     if (!model()->showItemNames())
    997     {
    998         pPainter->drawLine(m_extraButtonRect.topLeft() + QPoint(3, 3),
    999                            QPoint(m_extraButtonRect.right() - 2, m_extraButtonRect.center().y()));
    1000         pPainter->drawLine(m_extraButtonRect.bottomLeft() + QPoint(3, -3),
    1001                            QPoint(m_extraButtonRect.right() - 2, m_extraButtonRect.center().y()));
    1002     }
    1003     else
    1004     {
    1005         pPainter->drawLine(m_extraButtonRect.topRight() + QPoint(-3, 3),
    1006                            QPoint(m_extraButtonRect.left() + 3, m_extraButtonRect.center().y()));
    1007         pPainter->drawLine(m_extraButtonRect.bottomRight() + QPoint(-3, -3),
    1008                            QPoint(m_extraButtonRect.left() + 3, m_extraButtonRect.center().y()));
    1009     }
    1010 
    1011     /* Restore painter: */
    1012     pPainter->restore();
    1013 }
    1014 
    1015930/* static */
    1016931void UIToolsItem::paintPixmap(QPainter *pPainter, const QPoint &point,
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h

    r108106 r108125  
    8787      * @param  icon          Brings the item icon.
    8888      * @param  enmClass      Brings the item class.
    89       * @param  enmType       Brings the item type.
    90       * @param  fExtraButton  Brings whether item should have extra-button. */
     89      * @param  enmType       Brings the item type. */
    9190    UIToolsItem(QGraphicsScene *pScene, const QIcon &icon,
    92                 UIToolClass enmClass, UIToolType enmType,
    93                 bool fExtraButton = false);
     91                UIToolClass enmClass, UIToolType enmType);
    9492    /** Destructs item. */
    9593    virtual ~UIToolsItem() RT_OVERRIDE;
     
    113111        UIToolType itemType() const { return m_enmType; }
    114112
    115         /** Returns whether item should have extra-button. */
    116         bool hasExtraButton() const { return m_fExtraButton; }
    117 
    118113        /** Defines whether item is @a fEnabled. */
    119114        void setEnabled(bool fEnabled);
     
    139134          * @param  constraint  Brings size constraint. */
    140135        virtual QSizeF sizeHint(Qt::SizeHint enmWhich, const QSizeF &constraint = QSizeF()) const RT_OVERRIDE;
    141 
    142         /** Returns the extra-button rectangle. */
    143         QRect extraButtonRect() const { return m_extraButtonRect; }
    144136    /** @} */
    145137
     
    177169        ToolsItemData_Spacing,
    178170        ToolsItemData_Padding,
    179         ToolsItemData_ExtraButtonWidth,
    180171    };
    181172
     
    233224          * @param  rectangle  Brings the rectangle to limit painting with. */
    234225        void paintToolInfo(QPainter *pPainter, const QRect &rectangle) const;
    235         /** Paints extra-button using using passed @a pPainter.
    236           * @param  rectangle  Brings the rectangle to limit painting with. */
    237         void paintExtraButton(QPainter *pPainter, const QRect &rectangle) const;
    238226
    239227        /** Paints @a pixmap using passed @a pPainter.
     
    267255        /** Holds the item type. */
    268256        UIToolType      m_enmType;
    269         /** Holds whether item should have extra-button. */
    270         bool            m_fExtraButton;
    271257
    272258        /** Holds the item pixmap. */
     
    317303        /** Holds the name size. */
    318304        QSize  m_nameSize;
    319 
    320         /** Holds the extra-button rectangle. */
    321         mutable QRect  m_extraButtonRect;
    322305    /** @} */
    323306};
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r108122 r108125  
    323323{
    324324    return m_fShowItemNames;
    325 }
    326 
    327 bool UIToolsModel::isAtLeastOneItemHovered() const
    328 {
    329     foreach (UIToolsItem *pItem, items())
    330         if (pItem->isHovered())
    331             return true;
    332     return false;
    333325}
    334326
     
    503495}
    504496
    505 void UIToolsModel::sltHandleItemHoverChange()
    506 {
    507     /* Just update all the items: */
    508     foreach (UIToolsItem *pItem, items())
    509         pItem->update();
    510 }
    511 
    512497void UIToolsModel::sltFocusItemDestroyed()
    513498{
     
    651636    connect(&translationEventListener(), &UITranslationEventListener::sigRetranslateUI,
    652637            this, &UIToolsModel::sltRetranslateUI);
    653 
    654     /* Connect item hover listeners: */
    655     foreach (UIToolsItem *pItem, m_items)
    656     {
    657         connect(pItem, &UIToolsItem::sigHoverEnter,
    658                 this, &UIToolsModel::sltHandleItemHoverChange);
    659         connect(pItem, &UIToolsItem::sigHoverLeave,
    660                 this, &UIToolsModel::sltHandleItemHoverChange);
    661     }
    662638}
    663639
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h

    r108120 r108125  
    132132        /** Returns whether we should show item names. */
    133133        bool showItemNames() const;
    134 
    135         /** Returns whether at least one item hovered. */
    136         bool isAtLeastOneItemHovered() const;
    137134    /** @} */
    138135
     
    191188
    192189private slots:
    193 
    194     /** @name Children stuff.
    195       * @{ */
    196        /** Handles signal about one of items was [un]hovered. */
    197        void sltHandleItemHoverChange();
    198     /** @} */
    199190
    200191    /** @name Selection stuff.
Note: See TracChangeset for help on using the changeset viewer.

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