VirtualBox

Changeset 99177 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 24, 2023 3:46:06 PM (22 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10343: Adjust UIUSBFilterDetailsEditor to have line-edits of a bit more suitable size.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp

    r98103 r99177  
    7171void QILineEdit::setMinimumWidthByText(const QString &strText)
    7272{
    73     setMinimumWidth(featTextWidth(strText).width());
     73    setMinimumWidth(fitTextWidth(strText).width());
    7474}
    7575
    7676void QILineEdit::setFixedWidthByText(const QString &strText)
    7777{
    78     setFixedWidth(featTextWidth(strText).width());
     78    setFixedWidth(fitTextWidth(strText).width());
    7979}
    8080
     
    174174}
    175175
    176 QSize QILineEdit::featTextWidth(const QString &strText) const
     176QSize QILineEdit::fitTextWidth(const QString &strText) const
    177177{
    178178    QStyleOptionFrame sof;
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h

    r98103 r99177  
    8484
    8585    /** Calculates suitable @a strText size. */
    86     QSize featTextWidth(const QString &strText) const;
     86    QSize fitTextWidth(const QString &strText) const;
    8787
    8888    /** Holds whether this is allowed to copy contents when disabled. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUSBFilterDetailsEditor.cpp

    r99066 r99177  
    3030#include <QGridLayout>
    3131#include <QLabel>
    32 #include <QLineEdit>
    3332#include <QRegularExpressionValidator>
    3433
    3534/* GUI includes: */
    3635#include "QIDialogButtonBox.h"
     36#include "QILineEdit.h"
    3737#include "UIConverter.h"
    3838#include "UIUSBFilterDetailsEditor.h"
     
    245245    /* Adjust dialog size: */
    246246    adjustSize();
    247 
    248 #ifdef VBOX_WS_MAC
    249     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    250     setFixedSize(minimumSize());
    251 #endif /* VBOX_WS_MAC */
    252247}
    253248
     
    268263        }
    269264        /* Prepare name editor: */
    270         m_pEditorName = new QLineEdit(this);
     265        m_pEditorName = new QILineEdit(this);
    271266        if (m_pEditorName)
    272267        {
    273268            if (m_pLabelName)
    274269                m_pLabelName->setBuddy(m_pEditorName);
     270            m_pEditorName->setMinimumWidthByText(QString().fill('0', 32));
    275271            m_pEditorName->setValidator(new QRegularExpressionValidator(QRegularExpression(".+"), this));
    276 
    277272            pLayout->addWidget(m_pEditorName, 0, 1);
    278273        }
     
    286281        }
    287282        /* Prepare vendor ID editor: */
    288         m_pEditorVendorID = new QLineEdit(this);
     283        m_pEditorVendorID = new QILineEdit(this);
    289284        if (m_pEditorVendorID)
    290285        {
    291286            if (m_pLabelVendorID)
    292287                m_pLabelVendorID->setBuddy(m_pEditorVendorID);
     288            m_pEditorVendorID->setMinimumWidthByText(QString().fill('0', 8));
    293289            m_pEditorVendorID->setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9a-fA-F]{0,4}"), this));
    294 
    295290            pLayout->addWidget(m_pEditorVendorID, 1, 1);
    296291        }
     
    304299        }
    305300        /* Prepare product ID editor: */
    306         m_pEditorProductID = new QLineEdit(this);
     301        m_pEditorProductID = new QILineEdit(this);
    307302        if (m_pEditorProductID)
    308303        {
    309304            if (m_pLabelProductID)
    310305                m_pLabelProductID->setBuddy(m_pEditorProductID);
     306            m_pEditorProductID->setMinimumWidthByText(QString().fill('0', 8));
    311307            m_pEditorProductID->setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9a-fA-F]{0,4}"), this));
    312 
    313308            pLayout->addWidget(m_pEditorProductID, 2, 1);
    314309        }
     
    322317        }
    323318        /* Prepare revision editor: */
    324         m_pEditorRevision = new QLineEdit(this);
     319        m_pEditorRevision = new QILineEdit(this);
    325320        if (m_pEditorRevision)
    326321        {
    327322            if (m_pLabelRevision)
    328323                m_pLabelRevision->setBuddy(m_pEditorRevision);
     324            m_pEditorRevision->setMinimumWidthByText(QString().fill('0', 8));
    329325            m_pEditorRevision->setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9a-fA-F]{0,4}"), this));
    330 
    331326            pLayout->addWidget(m_pEditorRevision, 3, 1);
    332327        }
     
    340335        }
    341336        /* Prepare manufacturer editor: */
    342         m_pEditorManufacturer = new QLineEdit(this);
     337        m_pEditorManufacturer = new QILineEdit(this);
    343338        if (m_pEditorManufacturer)
    344339        {
    345340            if (m_pLabelManufacturer)
    346341                m_pLabelManufacturer->setBuddy(m_pEditorManufacturer);
     342            m_pEditorManufacturer->setMinimumWidthByText(QString().fill('0', 8));
    347343            pLayout->addWidget(m_pEditorManufacturer, 4, 1);
    348344        }
     
    356352        }
    357353        /* Prepare product editor: */
    358         m_pEditorProduct = new QLineEdit(this);
     354        m_pEditorProduct = new QILineEdit(this);
    359355        if (m_pEditorProduct)
    360356        {
    361357            if (m_pLabelProduct)
    362358                m_pLabelProduct->setBuddy(m_pEditorProduct);
     359            m_pEditorProduct->setMinimumWidthByText(QString().fill('0', 8));
    363360            pLayout->addWidget(m_pEditorProduct, 5, 1);
    364361        }
     
    372369        }
    373370        /* Prepare serial NO editor: */
    374         m_pEditorSerialNo = new QLineEdit(this);
     371        m_pEditorSerialNo = new QILineEdit(this);
    375372        if (m_pEditorSerialNo)
    376373        {
    377374            if (m_pLabelSerialNo)
    378375                m_pLabelSerialNo->setBuddy(m_pEditorSerialNo);
     376            m_pEditorSerialNo->setMinimumWidthByText(QString().fill('0', 8));
    379377            pLayout->addWidget(m_pEditorSerialNo, 6, 1);
    380378        }
     
    388386        }
    389387        /* Prepare port editor: */
    390         m_pEditorPort = new QLineEdit(this);
     388        m_pEditorPort = new QILineEdit(this);
    391389        if (m_pEditorPort)
    392390        {
    393391            if (m_pLabelPort)
    394392                m_pLabelPort->setBuddy(m_pEditorPort);
     393            m_pEditorPort->setMinimumWidthByText(QString().fill('0', 8));
    395394            m_pEditorPort->setValidator(new QRegularExpressionValidator(QRegularExpression("(0[xX])?[0-9a-fA-F]{0,4}"), this));
    396 
    397395            pLayout->addWidget(m_pEditorPort, 7, 1);
    398396        }
     
    414412            m_pComboRemote->addItem(QString(), QVariant::fromValue(UIRemoteMode_On));  /* Yes */
    415413            m_pComboRemote->addItem(QString(), QVariant::fromValue(UIRemoteMode_Off)); /* No */
    416 
    417414            pLayout->addWidget(m_pComboRemote, 8, 1);
    418415        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUSBFilterDetailsEditor.h

    r98103 r99177  
    3939class QComboBox;
    4040class QLabel;
    41 class QLineEdit;
    4241class QIDialogButtonBox;
     42class QILineEdit;
    4343
    4444/** QIDialog subclass used as a USB filter editor. */
     
    119119        QLabel            *m_pLabelName;
    120120        /** Holds the name editor instance. */
    121         QLineEdit         *m_pEditorName;
     121        QILineEdit        *m_pEditorName;
    122122        /** Holds the vendor ID label instance. */
    123123        QLabel            *m_pLabelVendorID;
    124124        /** Holds the vendor ID editor instance. */
    125         QLineEdit         *m_pEditorVendorID;
     125        QILineEdit        *m_pEditorVendorID;
    126126        /** Holds the product ID label instance. */
    127127        QLabel            *m_pLabelProductID;
    128128        /** Holds the product ID editor instance. */
    129         QLineEdit         *m_pEditorProductID;
     129        QILineEdit        *m_pEditorProductID;
    130130        /** Holds the revision label instance. */
    131131        QLabel            *m_pLabelRevision;
    132132        /** Holds the revision editor instance. */
    133         QLineEdit         *m_pEditorRevision;
     133        QILineEdit        *m_pEditorRevision;
    134134        /** Holds the manufacturer label instance. */
    135135        QLabel            *m_pLabelManufacturer;
    136136        /** Holds the manufacturer editor instance. */
    137         QLineEdit         *m_pEditorManufacturer;
     137        QILineEdit        *m_pEditorManufacturer;
    138138        /** Holds the product label instance. */
    139139        QLabel            *m_pLabelProduct;
    140140        /** Holds the product editor instance. */
    141         QLineEdit         *m_pEditorProduct;
     141        QILineEdit        *m_pEditorProduct;
    142142        /** Holds the serial NO label instance. */
    143143        QLabel            *m_pLabelSerialNo;
    144144        /** Holds the serial NO editor instance. */
    145         QLineEdit         *m_pEditorSerialNo;
     145        QILineEdit        *m_pEditorSerialNo;
    146146        /** Holds the port label instance. */
    147147        QLabel            *m_pLabelPort;
    148148        /** Holds the port editor instance. */
    149         QLineEdit         *m_pEditorPort;
     149        QILineEdit        *m_pEditorPort;
    150150        /** Holds the remote label instance. */
    151151        QLabel            *m_pLabelRemote;
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