Changeset 99179 in vbox for trunk/src/VBox
- Timestamp:
- Mar 24, 2023 3:58:10 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUSBFilterDetailsEditor.cpp
r99178 r99179 260 260 void UIUSBFilterDetailsEditor::prepareWidgets() 261 261 { 262 /* Name field validation: */ 263 const QRegularExpression re1(".+"); 264 /* Integer field validation, supports hex ranges: */ 265 const QString strHexValue("((0[xX])?[0-9a-fA-F]{1,4})"); 266 const QString strRange = QString("(%1|-%1|%1-|%1-%1)").arg(strHexValue); 267 const QString strRanges = QString("(%1(,%1)*)?").arg(strRange); 268 const QRegularExpression re2(strRanges); 269 262 270 /* Prepare main layout: */ 263 271 QGridLayout *pLayout = new QGridLayout(this); … … 280 288 m_pLabelName->setBuddy(m_pEditorName); 281 289 m_pEditorName->setMinimumWidthByText(QString().fill('0', 32)); 282 m_pEditorName->setValidator(new QRegularExpressionValidator( QRegularExpression(".+"), this));290 m_pEditorName->setValidator(new QRegularExpressionValidator(re1, this)); 283 291 connect(m_pEditorName, &QLineEdit::textChanged, 284 292 this, &UIUSBFilterDetailsEditor::sltRevalidate); … … 300 308 m_pLabelVendorID->setBuddy(m_pEditorVendorID); 301 309 m_pEditorVendorID->setMinimumWidthByText(QString().fill('0', 8)); 302 m_pEditorVendorID->setValidator(new QRegularExpressionValidator( QRegularExpression("[0-9a-fA-F]{0,4}"), this));310 m_pEditorVendorID->setValidator(new QRegularExpressionValidator(re2, this)); 303 311 connect(m_pEditorVendorID, &QLineEdit::textChanged, 304 312 this, &UIUSBFilterDetailsEditor::sltRevalidate); … … 320 328 m_pLabelProductID->setBuddy(m_pEditorProductID); 321 329 m_pEditorProductID->setMinimumWidthByText(QString().fill('0', 8)); 322 m_pEditorProductID->setValidator(new QRegularExpressionValidator( QRegularExpression("[0-9a-fA-F]{0,4}"), this));330 m_pEditorProductID->setValidator(new QRegularExpressionValidator(re2, this)); 323 331 connect(m_pEditorProductID, &QLineEdit::textChanged, 324 332 this, &UIUSBFilterDetailsEditor::sltRevalidate); … … 340 348 m_pLabelRevision->setBuddy(m_pEditorRevision); 341 349 m_pEditorRevision->setMinimumWidthByText(QString().fill('0', 8)); 342 m_pEditorRevision->setValidator(new QRegularExpressionValidator( QRegularExpression("[0-9a-fA-F]{0,4}"), this));350 m_pEditorRevision->setValidator(new QRegularExpressionValidator(re2, this)); 343 351 connect(m_pEditorRevision, &QLineEdit::textChanged, 344 352 this, &UIUSBFilterDetailsEditor::sltRevalidate); … … 411 419 m_pLabelPort->setBuddy(m_pEditorPort); 412 420 m_pEditorPort->setMinimumWidthByText(QString().fill('0', 8)); 413 m_pEditorPort->setValidator(new QRegularExpressionValidator( QRegularExpression("(0[xX])?[0-9a-fA-F]{0,4}"), this));421 m_pEditorPort->setValidator(new QRegularExpressionValidator(re2, this)); 414 422 connect(m_pEditorPort, &QLineEdit::textChanged, 415 423 this, &UIUSBFilterDetailsEditor::sltRevalidate);
Note:
See TracChangeset
for help on using the changeset viewer.