- Timestamp:
- Mar 27, 2019 1:27:07 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerKeyboard.cpp
r77844 r77919 278 278 case Qt::Key_Space: 279 279 { 280 /* If model is performing lookup: */281 if (model()->isLookupInProgress())282 {283 /* Continue lookup: */284 QString strText = pEvent->text();285 if (!strText.isEmpty())286 model()->lookFor(strText);287 }288 280 /* If there is a focus item: */ 289 elseif (UIChooserItem *pFocusItem = model()->focusItem())281 if (UIChooserItem *pFocusItem = model()->focusItem()) 290 282 { 291 283 /* Of the group type: */ … … 314 306 { 315 307 /* Start lookup: */ 316 QString strText = pEvent->text();308 const QString strText = pEvent->text(); 317 309 if (!strText.isEmpty()) 318 310 model()->lookFor(strText); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r77918 r77919 66 66 , m_iScrollingTokenSize(30) 67 67 , m_fIsScrollingInProgress(false) 68 , m_pLookupTimer(0)69 68 { 70 69 prepare(); … … 565 564 } 566 565 567 void UIChooserModel::lookFor(const QString &strLookup Symbol)566 void UIChooserModel::lookFor(const QString &strLookupText) 568 567 { 569 568 if (view()) 570 569 { 571 570 view()->setSearchWidgetVisible(true); 572 view()->appendToSearchString(strLookupSymbol); 573 } 574 } 575 576 bool UIChooserModel::isLookupInProgress() const 577 { 578 return m_pLookupTimer->isActive(); 571 view()->appendToSearchString(strLookupText); 572 } 579 573 } 580 574 … … 1147 1141 } 1148 1142 1149 void UIChooserModel::sltEraseLookupTimer()1150 {1151 m_pLookupTimer->stop();1152 m_strLookupString = QString();1153 }1154 1155 1143 void UIChooserModel::prepare() 1156 1144 { 1157 1145 prepareScene(); 1158 prepareLookup();1159 1146 prepareContextMenu(); 1160 1147 prepareHandlers(); … … 1167 1154 if (m_pScene) 1168 1155 m_pScene->installEventFilter(this); 1169 }1170 1171 void UIChooserModel::prepareLookup()1172 {1173 m_pLookupTimer = new QTimer(this);1174 if (m_pLookupTimer)1175 {1176 m_pLookupTimer->setInterval(1000);1177 m_pLookupTimer->setSingleShot(true);1178 connect(m_pLookupTimer, SIGNAL(timeout()), this, SLOT(sltEraseLookupTimer()));1179 }1180 1156 } 1181 1157 … … 1357 1333 } 1358 1334 1359 void UIChooserModel::cleanupLookup()1360 {1361 delete m_pLookupTimer;1362 m_pLookupTimer = 0;1363 }1364 1365 1335 void UIChooserModel::cleanupScene() 1366 1336 { … … 1373 1343 cleanupHandlers(); 1374 1344 cleanupContextMenu(); 1375 cleanupLookup();1376 1345 cleanupScene(); 1377 1346 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r77916 r77919 205 205 void setCurrentDragObject(QDrag *pDragObject); 206 206 207 /** Looks for item with certain @a strLookupSymbol. */ 208 void lookFor(const QString &strLookupSymbol); 209 /** Returns whether looking is in progress. */ 210 bool isLookupInProgress() const; 207 /** Looks for item with certain @a strLookupText. */ 208 void lookFor(const QString &strLookupText); 211 209 /** @} */ 212 210 … … 285 283 /** Handles machine search widget show/hide request. */ 286 284 void sltShowHideSearchWidget(); 287 /** Handles request to erase lookup timer. */288 void sltEraseLookupTimer();289 285 /** @} */ 290 286 … … 297 293 /** Prepares scene. */ 298 294 void prepareScene(); 299 /** Prepares lookup. */300 void prepareLookup();301 295 /** Prepares context-menu. */ 302 296 void prepareContextMenu(); … … 314 308 /** Cleanups context-menu. */ 315 309 void cleanupContextMenu(); 316 /** Cleanups lookup. */317 void cleanupLookup();318 310 /** Cleanups scene. */ 319 311 void cleanupScene(); … … 408 400 /** Holds whether drag scrolling is in progress. */ 409 401 bool m_fIsScrollingInProgress; 410 411 /** Holds the item lookup timer instance. */412 QTimer *m_pLookupTimer;413 /** Holds the item lookup string. */414 QString m_strLookupString;415 402 /** @} */ 416 403 };
Note:
See TracChangeset
for help on using the changeset viewer.