Changeset 89144 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 18, 2021 4:09:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.cpp
r89106 r89144 497 497 /* Prepare variables: */ 498 498 const int iSpacing = data(SetData_Spacing).toInt(); 499 int iMinimumWidthHint = 0; 499 int iMinimumWidthHintPreview = 0; 500 int iMinimumWidthHintInGroup = 0; 501 int iMinimumWidthHintOutGroup = 0; 500 502 501 503 /* Take into account all the elements: */ 502 foreach (UIDetailsItem *pItem, items())503 {504 /* Skip hidden: */505 if (!pItem->isVisible())506 continue;507 508 /* For each particular element: */509 UIDetailsElement *pElement = pItem->toElement();510 switch (pElement->elementType())511 {512 case DetailsElementType_General:513 case DetailsElementType_System:514 case DetailsElementType_Display:515 case DetailsElementType_Storage:516 case DetailsElementType_Audio:517 case DetailsElementType_Network:518 case DetailsElementType_Serial:519 case DetailsElementType_USB:520 case DetailsElementType_SF:521 case DetailsElementType_UI:522 case DetailsElementType_Description:523 {524 iMinimumWidthHint = qMax(iMinimumWidthHint, pItem->minimumWidthHint());525 break;526 }527 case DetailsElementType_Preview:528 {529 UIDetailsItem *pGeneralItem = element(DetailsElementType_General);530 UIDetailsItem *pSystemItem = element(DetailsElementType_System);531 int iGeneralElementWidth = pGeneralItem ? pGeneralItem->minimumWidthHint() : 0;532 int iSystemElementWidth = pSystemItem ? pSystemItem->minimumWidthHint() : 0;533 int iFirstColumnWidth = qMax(iGeneralElementWidth, iSystemElementWidth);534 iMinimumWidthHint = qMax(iMinimumWidthHint, iFirstColumnWidth + iSpacing + pItem->minimumWidthHint());535 break;536 }537 default: AssertFailed(); break; /* Shut up, MSC! */538 }539 }540 541 /* Return result: */542 return iMinimumWidthHint;543 }544 545 int UIDetailsSet::minimumHeightHint() const546 {547 /* Zero if has no details: */548 if (!hasDetails())549 return 0;550 551 /* Prepare variables: */552 const int iMargin = data(SetData_Margin).toInt();553 const int iSpacing = data(SetData_Spacing).toInt();554 555 /* Take into account all the elements: */556 int iMinimumHeightHintPreview = 0;557 int iMinimumHeightHintInGroup = 0;558 int iMinimumHeightHintOutGroup = 0;559 504 foreach (UIDetailsItem *pItem, items()) 560 505 { … … 572 517 /* Calculate corresponding hints: */ 573 518 if (enmElementType == DetailsElementType_Preview) 519 iMinimumWidthHintPreview = pItem->minimumWidthHint(); 520 else 521 { 522 if (m_listPreviewGroup.contains(enmElementType)) 523 iMinimumWidthHintInGroup = qMax(iMinimumWidthHintInGroup, pItem->minimumWidthHint()); 524 else if (m_listOutsideGroup.contains(enmElementType)) 525 iMinimumWidthHintOutGroup = qMax(iMinimumWidthHintOutGroup, pItem->minimumWidthHint()); 526 } 527 } 528 529 /* Append minimum width of Preview and Preview group: */ 530 int iMinimumWidthHint = 0; 531 if (iMinimumWidthHintPreview) 532 iMinimumWidthHint += iMinimumWidthHintPreview; 533 if (iMinimumWidthHintInGroup) 534 iMinimumWidthHint += iMinimumWidthHintInGroup; 535 if (iMinimumWidthHintPreview && iMinimumWidthHintInGroup) 536 iMinimumWidthHint += iSpacing; 537 /* Compare with minimum width of Outside group: */ 538 iMinimumWidthHint = qMax(iMinimumWidthHint, iMinimumWidthHintOutGroup); 539 /* Return result: */ 540 return iMinimumWidthHint; 541 } 542 543 int UIDetailsSet::minimumHeightHint() const 544 { 545 /* Zero if has no details: */ 546 if (!hasDetails()) 547 return 0; 548 549 /* Prepare variables: */ 550 const int iMargin = data(SetData_Margin).toInt(); 551 const int iSpacing = data(SetData_Spacing).toInt(); 552 int iMinimumHeightHintPreview = 0; 553 int iMinimumHeightHintInGroup = 0; 554 int iMinimumHeightHintOutGroup = 0; 555 556 /* Take into account all the elements: */ 557 foreach (UIDetailsItem *pItem, items()) 558 { 559 /* Make sure item exists: */ 560 AssertPtrReturn(pItem, 0); 561 /* Skip item if hidden: */ 562 if (!pItem->isVisible()) 563 continue; 564 565 /* Acquire element type: */ 566 UIDetailsElement *pElement = pItem->toElement(); 567 AssertPtrReturn(pElement, 0); 568 DetailsElementType enmElementType = pElement->elementType(); 569 570 /* Calculate corresponding hints: */ 571 if (enmElementType == DetailsElementType_Preview) 574 572 iMinimumHeightHintPreview += pItem->minimumHeightHint(); 575 573 else … … 585 583 iMinimumHeightHintOutGroup -= iSpacing; 586 584 587 /* Append m aximum height of Preview and Preview group: */585 /* Append minimum height of Preview and Preview group: */ 588 586 int iMinimumHeightHint = qMax(iMinimumHeightHintPreview, iMinimumHeightHintInGroup); 589 587 /* Add spacing if necessary: */
Note:
See TracChangeset
for help on using the changeset viewer.