VirtualBox

Changeset 5762 in vbox for trunk


Ignore:
Timestamp:
Nov 15, 2007 6:10:55 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
26147
Message:

FE/Qt: Added support for custom button texts in QIMessageBox.

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

Legend:

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

    r4482 r5762  
    5151    {
    5252        NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
    53         Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9, ButtonMask = 0xff,
    54         Default = 0x100, Escape = 0x200, FlagMask = 0x300
     53        Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
     54        ButtonMask = 0xFF,
     55
     56        Default = 0x100, Escape = 0x200,
     57        FlagMask = 0x300
    5558    };
    5659
     
    5962                  QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE,
    6063                  WFlags aFlags = WStyle_DialogBorder);
     64
     65    QString buttonText (int aButton) const;
     66    void setButtonText (int aButton, const QString &aText);
    6167
    6268    QString flagText() const { return mFlagCB->isShown() ? mFlagCB->text() : QString::null; }
  • trunk/src/VBox/Frontends/VirtualBox/src/QIMessageBox.cpp

    r4482 r5762  
    134134}
    135135
     136/**
     137 *  Returns the text of the given message box button.
     138 *  See QMessageBox::buttonText() for details.
     139 *
     140 *  @param aButton Button index (0, 1 or 2).
     141 */
     142QString QIMessageBox::buttonText (int aButton) const
     143{
     144    switch (aButton)
     145    {
     146        case 0: if (mButton0PB) return mButton0PB->text(); break;
     147        case 1: if (mButton1PB) return mButton1PB->text(); break;
     148        case 2: if (mButton2PB) return mButton2PB->text(); break;
     149        default: break;
     150    }
     151
     152    return QString::null;
     153}
     154
     155/**
     156 *  Sets the text of the given message box button.
     157 *  See QMessageBox::setButtonText() for details.
     158 *
     159 *  @param aButton  Button index (0, 1 or 2).
     160 *  @param aText    New button text.
     161 */
     162void QIMessageBox::setButtonText (int aButton, const QString &aText)
     163{
     164    switch (aButton)
     165    {
     166        case 0: if (mButton0PB) mButton0PB->setText (aText); break;
     167        case 1: if (mButton1PB) mButton1PB->setText (aText); break;
     168        case 2: if (mButton2PB) mButton2PB->setText (aText); break;
     169        default: break;
     170    }
     171}
     172
    136173/** @fn QIMessageBox::flagText() const
    137174 *
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