VirtualBox

Changeset 71869 in vbox for trunk


Ignore:
Timestamp:
Apr 17, 2018 10:34:38 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Full cleanup for QILineEdit and move it to VBoxGlobal library.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r71866 r71869  
    658658        src/extensions/QILabel.h \
    659659        src/extensions/QILabelSeparator.h \
     660        src/extensions/QILineEdit.h \
    660661        src/extensions/QIMainWindow.h \
    661662        src/extensions/QIMessageBox.h \
     
    733734        src/extensions/QILabel.h \
    734735        src/extensions/QILabelSeparator.h \
     736        src/extensions/QILineEdit.h \
    735737        src/extensions/QIMainWindow.h \
    736738        src/extensions/QIMessageBox.h \
     
    907909        src/UITakeSnapshotDialog.cpp \
    908910        src/extensions/QIFlowLayout.cpp \
    909         src/extensions/QILineEdit.cpp \
    910911        src/extensions/QIMainDialog.cpp \
    911912        src/extensions/QIManagerDialog.cpp \
     
    11571158        src/extensions/QILabel.cpp \
    11581159        src/extensions/QILabelSeparator.cpp \
     1160        src/extensions/QILineEdit.cpp \
    11591161        src/extensions/QIMainWindow.cpp \
    11601162        src/extensions/QIMessageBox.cpp \
     
    12591261        src/extensions/QILabel.cpp \
    12601262        src/extensions/QILabelSeparator.cpp \
     1263        src/extensions/QILineEdit.cpp \
    12611264        src/extensions/QIMainWindow.cpp \
    12621265        src/extensions/QIMessageBox.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp

    r71027 r71869  
    11/* $Id$ */
    22/** @file
    3  * VirtualBox Qt GUI - QILineEdit class implementation.
     3 * VBox Qt GUI - Qt extensions: QILineEdit class implementation.
    44 */
    55
    66/*
    7  * Copyright (C) 2008-2017 Oracle Corporation
     7 * Copyright (C) 2008-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2929
    3030
    31 void QILineEdit::setMinimumWidthByText (const QString &aText)
     31void QILineEdit::setMinimumWidthByText(const QString &strText)
    3232{
    33     setMinimumWidth (featTextWidth (aText).width());
     33    setMinimumWidth(featTextWidth(strText).width());
    3434}
    3535
    36 void QILineEdit::setFixedWidthByText (const QString &aText)
     36void QILineEdit::setFixedWidthByText(const QString &strText)
    3737{
    38     setFixedWidth (featTextWidth (aText).width());
     38    setFixedWidth(featTextWidth(strText).width());
    3939}
    4040
    41 QSize QILineEdit::featTextWidth (const QString &aText) const
     41QSize QILineEdit::featTextWidth(const QString &strText) const
    4242{
    4343    QStyleOptionFrame sof;
    44     sof.initFrom (this);
     44    sof.initFrom(this);
    4545    sof.rect = contentsRect();
    46     sof.lineWidth = hasFrame() ? style()->pixelMetric (QStyle::PM_DefaultFrameWidth) : 0;
     46    sof.lineWidth = hasFrame() ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0;
    4747    sof.midLineWidth = 0;
    4848    sof.state |= QStyle::State_Sunken;
    4949
    50     /* The margins are based on qlineedit.cpp of Qt. Maybe they where changed
    51      * at some time in the future. */
    52     QSize sc (fontMetrics().width (aText) + 2*2,
    53               fontMetrics().xHeight()     + 2*1);
    54     QSize sa = style()->sizeFromContents (QStyle::CT_LineEdit, &sof, sc, this);
     50    /** @todo make it wise.. */
     51    // WORKAROUND:
     52    // The margins are based on qlineedit.cpp of Qt.
     53    // Maybe they where changed at some time in the future.
     54    QSize sc(fontMetrics().width(strText) + 2 * 2,
     55             fontMetrics().xHeight()     + 2 * 1);
     56    const QSize sa = style()->sizeFromContents(QStyle::CT_LineEdit, &sof, sc, this);
    5557
    5658    return sa;
    5759}
    58 
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h

    r71027 r71869  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - QILineEdit class declarations.
     3 * VBox Qt GUI - Qt extensions: QILineEdit class declaration.
    44 */
    55
    66/*
    7  * Copyright (C) 2008-2017 Oracle Corporation
     7 * Copyright (C) 2008-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __QILineEdit_h__
    19 #define __QILineEdit_h__
     18#ifndef ___QILineEdit_h___
     19#define ___QILineEdit_h___
    2020
    2121/* Qt includes */
    2222#include <QLineEdit>
    2323
    24 class QILineEdit: public QLineEdit
     24/* GUI includes: */
     25#include "UILibraryDefs.h"
     26
     27/** QLineEdit extension with advanced functionality. */
     28class SHARED_LIBRARY_STUFF QILineEdit : public QLineEdit
    2529{
     30    Q_OBJECT;
     31
    2632public:
    2733
    28     QILineEdit (QWidget *aParent = 0)
    29         :QLineEdit (aParent) {}
    30     QILineEdit (const QString &aContents, QWidget *aParent = 0)
    31         :QLineEdit (aContents, aParent) {}
     34    /** Constructs label-separator passing @a pParent to the base-class. */
     35    QILineEdit(QWidget *pParent = 0)
     36        : QLineEdit(pParent) {}
     37    /** Constructs label-separator passing @a pParent to the base-class.
     38      * @param  strContents  Brings the line-edit text. */
     39    QILineEdit(const QString &strContents, QWidget *pParent = 0)
     40        : QLineEdit(strContents, pParent) {}
    3241
    33     void setMinimumWidthByText (const QString &aText);
    34     void setFixedWidthByText (const QString &aText);
     42    /** Forces line-edit to adjust minimum width acording to passed @a strText. */
     43    void setMinimumWidthByText(const QString &strText);
     44    /** Forces line-edit to adjust fixed width acording to passed @a strText. */
     45    void setFixedWidthByText(const QString &strText);
    3546
    3647private:
    3748
    38     QSize featTextWidth (const QString &aText) const;
     49    /** Calculates suitable @a strText size. */
     50    QSize featTextWidth(const QString &strText) const;
    3951};
    4052
    41 #endif /* __QILineEdit_h__ */
    42 
     53#endif /* !___QILineEdit_h___ */
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