Changeset 8370 in vbox for trunk/src/VBox
- Timestamp:
- Apr 24, 2008 4:49:18 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxHardDiskSettings.ui
r8339 r8370 271 271 <variable access="private">CMachine mMachine;</variable> 272 272 <variable access="private">QPopupMenu *mContextMenu;</variable> 273 <variable access="private">bool mCBFocusOut;</variable>274 273 </variables> 275 274 <signals> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxHardDiskSettings.ui.h
r8338 r8370 345 345 , mMachine (aMachine) 346 346 , mFocusColumn (-1) 347 , mAutoFocus (false) 347 348 { 348 349 init(); … … 407 408 { 408 409 mFocusColumn = aCol; 410 mAutoFocus = mFocusColumn != -1; 409 411 repaint(); 412 } 413 414 void setAutoFocus (bool aOn) 415 { 416 mAutoFocus = aOn; 410 417 } 411 418 … … 486 493 if (cb->isHidden()) 487 494 cb->show(); 488 if ( !cb->hasFocus())489 cb->setFocus();495 if (mAutoFocus && !cb->hasFocus()) 496 QTimer::singleShot (0, cb, SLOT (setFocus())); 490 497 } 491 498 else if (aColumn != mFocusColumn && !cb->isHidden()) … … 512 519 QPtrVector<QComboBox> mVector; 513 520 int mFocusColumn; 521 bool mAutoFocus; 514 522 }; 515 523 … … 527 535 { 528 536 mPrevItem = 0; 529 mCBFocusOut = false;530 537 531 538 /* toolbar */ … … 823 830 if (aItem != mPrevItem) 824 831 { 832 int prevFocusColumn = 833 mPrevItem && mPrevItem->rtti() == HDListItem::HDListItemType ? 834 static_cast<HDListItem*> (mPrevItem)->focusColumn() : 0; 835 836 if (mPrevItem && mPrevItem->rtti() == HDListItem::HDListItemType) 837 static_cast<HDListItem*> (mPrevItem)->moveFocusToColumn (-1); 838 825 839 if (aItem && aItem->rtti() == HDListItem::HDListItemType && 826 840 static_cast<HDListItem*> (aItem)->focusColumn() == -1) 827 {828 int prevFocusColumn = 0;829 if (mPrevItem && mPrevItem->rtti() == HDListItem::HDListItemType)830 prevFocusColumn = static_cast<HDListItem*> (mPrevItem)->focusColumn();831 841 static_cast<HDListItem*> (aItem)->moveFocusToColumn (prevFocusColumn); 832 }833 834 if (mPrevItem && mPrevItem->rtti() == HDListItem::HDListItemType)835 static_cast<HDListItem*> (mPrevItem)->moveFocusToColumn (-1);836 842 837 843 mPrevItem = aItem; … … 960 966 item->focusColumn() > 0) 961 967 { 968 item->setAutoFocus (false); 962 969 mLvHD->setFocus(); 963 970 item->moveFocusToColumn (item->focusColumn() - 1); … … 972 979 item->focusColumn() < mLvHD->columns() - 1) 973 980 { 981 item->setAutoFocus (false); 974 982 mLvHD->setFocus(); 975 983 item->moveFocusToColumn (item->focusColumn() + 1); … … 984 992 item->itemAbove()) 985 993 { 994 item->setAutoFocus (false); 986 995 mLvHD->setFocus(); 987 996 mLvHD->setCurrentItem (item->itemAbove()); … … 989 998 return true; 990 999 } else 991 /* Process cursor- up as "move focus up" action */1000 /* Process cursor-down as "move focus down" action */ 992 1001 if (e->key() == Qt::Key_Down && !e->state()) 993 1002 { … … 995 1004 item->itemBelow()) 996 1005 { 1006 item->setAutoFocus (false); 997 1007 mLvHD->setFocus(); 998 1008 mLvHD->setCurrentItem (item->itemBelow()); … … 1015 1025 item->showEditor(); 1016 1026 return true; 1027 } else 1028 if ((e->key() == Qt::Key_Tab && !e->state()) || 1029 e->key() == Qt::Key_Backtab) 1030 { 1031 item->setAutoFocus (false); 1032 mLvHD->setFocus(); 1017 1033 } 1018 1034 break; … … 1021 1037 case QEvent::FocusIn: 1022 1038 { 1023 if (aObject == mLvHD ||1024 aObject->inherits ("HDSlotItem") ||1025 aObject->inherits ("HDVdiItem"))1026 mCBFocusOut = false;1027 else if (mCBFocusOut)1028 {1029 mCBFocusOut = false;1030 mLvHD->setFocus();1031 focusNextPrevChild (true);1032 return true;1033 }1034 1035 1039 if (aObject == mLvHD) 1036 1040 onAfterCurrentChanged (mLvHD->currentItem()); 1037 1041 else if (!mGbHDList->queryList (0, 0, false, true)->contains (aObject)) 1038 1042 onAfterCurrentChanged (0); 1039 break;1040 }1041 case QEvent::FocusOut:1042 {1043 if (aObject->className() == "HDSlotItem" ||1044 aObject->className() == "HDVdiItem")1045 mCBFocusOut = true;1046 1043 1047 1044 break;
Note:
See TracChangeset
for help on using the changeset viewer.