VirtualBox

Changeset 9968 in vbox


Ignore:
Timestamp:
Jun 26, 2008 3:56:28 PM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt4: Slightly extend the QILabel api to let to:

  • get the frame width
  • set the frame shape
  • set the frame shadow
  • make the label adjust it's height if it is fixed and text requires more space.
Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/QILabel.h

    r9729 r9968  
    2929
    3030/* Qt includes */
    31 #include <QWidget>
     31#include <QFrame>
    3232
    3333class QILabelPrivate;
     
    5151    Qt::Alignment alignment() const;
    5252    QWidget * buddy() const;
     53    int frameWidth() const;
    5354    bool hasScaledContents() const;
    5455    int indent() const;
     
    6061    void setAlignment (Qt::Alignment aAlignment);
    6162    void setBuddy (QWidget *aBuddy);
     63    void setFrameShadow (QFrame::Shadow aShadow);
     64    void setFrameShape (QFrame::Shape aShape);
    6265    void setIndent (int aIndent);
    6366    void setMargin (int aMargin);
  • trunk/src/VBox/Frontends/VirtualBox4/src/QILabel.cpp

    r9862 r9968  
    9393}
    9494
     95int QILabel::frameWidth() const
     96{
     97    return mLabel->frameWidth();
     98}
     99
    95100bool QILabel::hasScaledContents () const
    96101{
     
    128133}
    129134
    130 void QILabel::setAlignment (Qt::Alignment aAlignment) 
    131 { 
    132     mLabel->setAlignment (aAlignment); 
     135void QILabel::setAlignment (Qt::Alignment aAlignment)
     136{
     137    mLabel->setAlignment (aAlignment);
    133138}
    134139
     
    138143}
    139144
     145void QILabel::setFrameShadow (QFrame::Shadow aShadow)
     146{
     147    mLabel->setFrameShadow (aShadow);
     148}
     149
     150void QILabel::setFrameShape (QFrame::Shape aShape)
     151{
     152    mLabel->setFrameShape (aShape);
     153}
     154
    140155void QILabel::setIndent (int aIndent)
    141156{
     
    149164
    150165void QILabel::setOpenExternalLinks (bool aOpen)
    151 { 
    152     mLabel->setOpenExternalLinks (aOpen); 
     166{
     167    mLabel->setOpenExternalLinks (aOpen);
    153168}
    154169
     
    163178}
    164179
    165 void QILabel::setTextInteractionFlags (Qt::TextInteractionFlags aFlags) 
    166 { 
    167     mLabel->setTextInteractionFlags (aFlags); 
    168 }
    169 
    170 void QILabel::setWordWrap (bool aOn) 
    171 { 
    172     mLabel->setWordWrap (aOn); 
     180void QILabel::setTextInteractionFlags (Qt::TextInteractionFlags aFlags)
     181{
     182    mLabel->setTextInteractionFlags (aFlags);
     183}
     184
     185void QILabel::setWordWrap (bool aOn)
     186{
     187    mLabel->setWordWrap (aOn);
    173188}
    174189
     
    238253{
    239254    mLabel->setFullText (aText);
     255
     256    /* If QILabel forced to be fixed vertically */
     257    if (minimumHeight() == maximumHeight())
     258    {
     259        /* Check if new text requires label growing */
     260        QSize sh (mLabel->width(), mLabel->heightForWidth (mLabel->width()));
     261        if (sh.height() > minimumHeight())
     262            setFixedHeight (sh.height());
     263    }
    240264}
    241265
     
    298322    if (aEvent->button() == Qt::LeftButton &&
    299323        geometry().contains (aEvent->pos()) &&
    300         mFullSizeSeclection) 
     324        mFullSizeSeclection)
    301325        mStartDragging = true;
    302326    else
     
    432456            text = QString (workStr).replace (compactStr, newStr);
    433457            /* For debug */
    434 //            printf ("%d, %s # %s # %s ## %s\n", pos, 
     458//            printf ("%d, %s # %s # %s ## %s\n", pos,
    435459//                    qPrintable (compactStr),
    436460//                    qPrintable (elideModeStr),
    437 //                    qPrintable (elideStr), 
     461//                    qPrintable (elideStr),
    438462//                    qPrintable (newStr));
    439463        }
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