VirtualBox

Ignore:
Timestamp:
Oct 22, 2009 11:44:58 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53839
Message:

FE/Qt4: Cleaning QILabel from garbage, reworking QILabel size-hint mechanism, updating related stuff; Fixing layout bug in Global Settings / Language page.

File:
1 edited

Legend:

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

    r16955 r24002  
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2828#define __QILabel_h__
    2929
    30 /* Qt includes */
    31 #include <QFrame>
     30/* Global includes */
     31#include <QLabel>
    3232
    33 class QILabelPrivate;
    34 
    35 class QILabel: public QWidget
     33class QILabel: public QLabel
    3634{
    3735    Q_OBJECT;
     
    3937public:
    4038
    41     QILabel (QWidget *aParent = NULL, Qt::WindowFlags aFlags = 0);
    42     QILabel (const QString &aText, QWidget *aParent = NULL, Qt::WindowFlags aFlags = 0);
     39    QILabel (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
     40    QILabel (const QString &aText, QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
    4341
    44     /* QLabel extensions */
    45     bool fullSizeSelection () const;
    46     void setFullSizeSelection (bool bOn);
     42    /* Focusing extensions */
     43    bool fullSizeSelection() const;
     44    void setFullSizeSelection (bool aEnabled);
    4745
    48     void updateSizeHint();
     46    /* Size-Hint extensions */
     47    void useSizeHintForWidth (int aWidthHint) const;
     48    QSize sizeHint() const;
     49    QSize minimumSizeHint() const;
    4950
    5051    /* Default QLabel methods */
    51     Qt::Alignment alignment() const;
    52     QWidget * buddy() const;
    53     int frameWidth() const;
    54     bool hasScaledContents() const;
    55     int indent() const;
    56     int margin() const;
    57     QMovie *movie() const;
    58     bool openExternalLinks() const;
    59     const QPicture *picture() const;
    60     const QPixmap *pixmap() const;
    61     void setAlignment (Qt::Alignment aAlignment);
    62     void setBuddy (QWidget *aBuddy);
    63     void setFrameShadow (QFrame::Shadow aShadow);
    64     void setFrameShape (QFrame::Shape aShape);
    65     void setIndent (int aIndent);
    66     void setMargin (int aMargin);
    67     void setOpenExternalLinks (bool aOpen);
    68     void setScaledContents (bool aOn);
    69     void setTextFormat (Qt::TextFormat aFormat);
    70     void setTextInteractionFlags (Qt::TextInteractionFlags aFlags);
    71     void setWordWrap (bool aOn);
    72     void setMinimumWidth (int aMinWidth);
    7352    QString text() const;
    74     Qt::TextFormat textFormat() const;
    75     Qt::TextInteractionFlags textInteractionFlags() const;
    76     bool wordWrap() const;
    77 
    78     /* Default QWidget methods */
    79     void setSizePolicy (QSizePolicy aPolicy);
    80     void setMinimumSize (const QSize &aSize);
    8153
    8254public slots:
    8355
    8456    void clear();
    85     void setMovie (QMovie *aMovie);
    86     void setNum (int aNum);
    87     void setNum (double aNum);
    88     void setPicture (const QPicture &aPicture);
    89     void setPixmap (const QPixmap &aPixmap);
    9057    void setText (const QString &aText);
    91 
    92 signals:
    93 
    94       void linkActivated (const QString &);
    95       void linkHovered (const QString &);
     58    void copy();
    9659
    9760protected:
    9861
    99     virtual void init();
     62    void resizeEvent (QResizeEvent *aEvent);
     63    void mousePressEvent (QMouseEvent *aEvent);
     64    void mouseReleaseEvent (QMouseEvent *aEvent);
     65    void mouseMoveEvent (QMouseEvent *aEvent);
     66    void contextMenuEvent (QContextMenuEvent *aEvent);
     67    void focusInEvent (QFocusEvent *aEvent);
     68    void focusOutEvent (QFocusEvent *aEvent);
     69    void paintEvent (QPaintEvent *aEvent);
    10070
    101     /* Protected member vars */
    102     QILabelPrivate *mLabel;
     71private:
     72
     73    void init();
     74
     75    void updateSizeHint() const;
     76    void setFullText (const QString &aText);
     77    void updateText();
     78    QString removeHtmlTags (QString aText) const;
     79    Qt::TextElideMode toTextElideMode (const QString& aStr) const;
     80    QString compressText (const QString &aText) const;
     81
     82    QString mText;
     83    bool mFullSizeSelection;
     84    static const QRegExp mCopyRegExp;
     85    static QRegExp mElideRegExp;
     86    mutable bool mIsHintValid;
     87    mutable int mWidthHint;
     88    mutable QSize mOwnSizeHint;
     89    bool mStartDragging;
     90    QAction *mCopyAction;
    10391};
    10492
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