VirtualBox

Ignore:
Timestamp:
Feb 18, 2010 7:20:55 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: Extending QIWithRetranslateUI template.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h

    r26502 r26636  
    77
    88/*
    9  * Copyright (C) 2008 Sun Microsystems, Inc.
     9 * Copyright (C) 2008-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525#define __QIWithRetranslateUI_h
    2626
    27 /* Qt includes */
     27/* Global includes */
    2828#include <QObject>
    2929#include <QEvent>
     
    3434public:
    3535
    36     QIWithRetranslateUI (QWidget *aParent = 0) : Base (aParent) {}
     36    QIWithRetranslateUI(QWidget *pParent = 0) : Base(pParent) {}
    3737
    3838protected:
    3939
    40     virtual void changeEvent (QEvent *aEvent)
     40    virtual void changeEvent(QEvent *pEvent)
    4141    {
    42         Base::changeEvent (aEvent);
    43         switch (aEvent->type())
     42        Base::changeEvent (pEvent);
     43        switch (pEvent->type())
    4444        {
    4545            case QEvent::LanguageChange:
    4646            {
    4747                retranslateUi();
    48                 aEvent->accept();
     48                pEvent->accept();
    4949                break;
    5050            }
     
    6262public:
    6363
    64     QIWithRetranslateUI2 (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0) : Base (aParent, aFlags) {}
     64    QIWithRetranslateUI2(QWidget *pParent = 0, Qt::WindowFlags fFlags = 0) : Base(pParent, fFlags) {}
    6565
    6666protected:
    6767
    68     virtual void changeEvent (QEvent *aEvent)
     68    virtual void changeEvent(QEvent *pEvent)
    6969    {
    70         Base::changeEvent (aEvent);
    71         switch (aEvent->type())
     70        Base::changeEvent (pEvent);
     71        switch (pEvent->type())
    7272        {
    7373            case QEvent::LanguageChange:
    7474            {
    7575                retranslateUi();
    76                 aEvent->accept();
     76                pEvent->accept();
    7777                break;
    7878            }
     
    8585};
    8686
     87template <class Base>
     88class QIWithRetranslateUI3: public Base
     89{
     90public:
     91
     92    QIWithRetranslateUI3(QObject *pParent = 0) : Base(pParent) {}
     93
     94protected:
     95
     96    virtual bool event(QEvent *pEvent)
     97    {
     98        bool bResult = Base::event(pEvent);
     99        switch (pEvent->type())
     100        {
     101            case QEvent::LanguageChange:
     102            {
     103                retranslateUi();
     104                pEvent->accept();
     105                bResult = true;
     106                break;
     107            }
     108            default:
     109                break;
     110        }
     111        return bResult;
     112    }
     113
     114    virtual void retranslateUi() = 0;
     115};
     116
    87117#endif /* __QIWithRetranslateUI_h */
    88 
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