VirtualBox

Changeset 88272 in vbox


Ignore:
Timestamp:
Mar 24, 2021 12:06:05 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Some more code style fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.cpp

    r88266 r88272  
    3131#include "UIWizardNewVM.h"
    3232
     33/*********************************************************************************************************************************
     34*   UIToolPageButton definition.                                                                                    *
     35*********************************************************************************************************************************/
     36/** A QAbstractButton extension used to show collapse/expand icons. More importantly
     37  * it is buddy to the title label which may include some mnemonics. This makes it possible
     38  * to expand pages via keyboard. */
    3339class UIToolPageButton : public QAbstractButton
    3440{
     41
    3542    Q_OBJECT;
     43
    3644public:
     45
    3746    UIToolPageButton(QWidget *pParent = 0);
    3847    void setPixmap(const QPixmap &pixmap);
     48
    3949protected:
     50
    4051    virtual void paintEvent(QPaintEvent *pEvent) /* override */;
    4152    virtual QSize sizeHint() const /* override */;
     53
    4254private:
     55
     56    /** Holds the pixmap of the expand/collapser icon. We keep
     57      * QPixmap instead of QIcon since it is rotated when the
     58      * the page is expanded and end product of rotation is a pixmap.
     59      * and we use QPainter to draw pixmap.*/
    4360    QPixmap m_pixmap;
    4461};
    45 
    46 UIToolPageButton::UIToolPageButton(QWidget *pParent /* = 0 */)
    47     :QAbstractButton(pParent)
    48 {
    49 }
    50 
    51 void UIToolPageButton::paintEvent(QPaintEvent *pEvent)
    52 {
    53     Q_UNUSED(pEvent);
    54     if (!m_pixmap.isNull())
    55     {
    56         QPainter painter(this);
    57         painter.drawPixmap(0, 0, m_pixmap.width(), m_pixmap.height(), m_pixmap);
    58     }
    59 }
    60 
    61 void UIToolPageButton::setPixmap(const QPixmap &pixmap)
    62 {
    63     m_pixmap = pixmap;
    64     update();
    65 }
    66 
    67 QSize UIToolPageButton::sizeHint() const
    68 {
    69     if (m_pixmap.isNull())
    70         return QSize (0,0);
    71     return m_pixmap.size();
    72 }
    7362
    7463/*********************************************************************************************************************************
     
    128117
    129118/*********************************************************************************************************************************
     119*   UIToolPageButton implementation.                                                                                    *
     120*********************************************************************************************************************************/
     121
     122UIToolPageButton::UIToolPageButton(QWidget *pParent /* = 0 */)
     123    :QAbstractButton(pParent)
     124{
     125}
     126
     127void UIToolPageButton::paintEvent(QPaintEvent *pEvent)
     128{
     129    Q_UNUSED(pEvent);
     130    if (!m_pixmap.isNull())
     131    {
     132        QPainter painter(this);
     133        painter.drawPixmap(0, 0, m_pixmap.width(), m_pixmap.height(), m_pixmap);
     134    }
     135}
     136
     137void UIToolPageButton::setPixmap(const QPixmap &pixmap)
     138{
     139    m_pixmap = pixmap;
     140    update();
     141}
     142
     143QSize UIToolPageButton::sizeHint() const
     144{
     145    if (m_pixmap.isNull())
     146        return QSize (0,0);
     147    return m_pixmap.size();
     148}
     149
     150/*********************************************************************************************************************************
    130151*   UIToolBoxPage implementation.                                                                                    *
    131152*********************************************************************************************************************************/
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