- Timestamp:
- Aug 4, 2023 10:34:46 AM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 158686
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.cpp
r98103 r100795 28 28 /* Qt includes: */ 29 29 #include <QComboBox> 30 #include <QHBoxLayout> 30 31 #include <QLineEdit> 31 32 #include <QPushButton> 32 33 #include <QPainter> 33 #include <QHBoxLayout> 34 #ifdef VBOX_IS_QT6_OR_LATER /* fromWildcard is available since 6.0 */ 35 # include <QRegularExpression> 36 #else 37 # include <QRegExp> 38 #endif 34 39 35 40 /* GUI includes: */ … … 69 74 if (!pMediumItem) 70 75 return false; 71 if (m_enmSearchType == UIMediumSearchWidget::SearchByUUID && 72 !pMediumItem->id().toString().contains(m_strSearchTerm, Qt::CaseInsensitive)) 73 return false; 74 if (m_enmSearchType == UIMediumSearchWidget::SearchByName && 75 !pMediumItem->name().contains(m_strSearchTerm, Qt::CaseInsensitive)) 76 return false; 77 return true; 76 QString strValue; 77 if (m_enmSearchType == UIMediumSearchWidget::SearchByUUID) 78 strValue = pMediumItem->id().toString(); 79 else if (m_enmSearchType == UIMediumSearchWidget::SearchByName) 80 strValue = pMediumItem->name(); 81 else 82 return false; 83 #ifdef VBOX_IS_QT6_OR_LATER /* fromWildcard is available since 6.0 */ 84 QRegularExpression searchRegEx = QRegularExpression::fromWildcard(m_strSearchTerm, Qt::CaseInsensitive, 85 QRegularExpression::UnanchoredWildcardConversion); 86 #else 87 QRegExp searchRegEx(m_strSearchTerm, Qt::CaseInsensitive, QRegExp::Wildcard); 88 #endif 89 if (strValue.contains(searchRegEx)) 90 return true; 91 return false; 78 92 } 79 93
Note:
See TracChangeset
for help on using the changeset viewer.