Changeset 44295 in vbox
- Timestamp:
- Jan 15, 2013 1:30:43 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
r44054 r44295 59 59 connect(this, SIGNAL(sigMinimumHeightHintChanged(int)), 60 60 model(), SIGNAL(sigRootItemMinimumHeightHintChanged(int))); 61 62 /* Init: */63 updateVisibleName();64 updateItemCountInfo();65 updateToolTip();66 61 } 67 62 … … 88 83 89 84 /* Init: */ 85 updateItemCountInfo(); 90 86 updateVisibleName(); 91 updateItemCountInfo();92 87 updateToolTip(); 93 88 } … … 116 111 117 112 /* Init: */ 113 updateItemCountInfo(); 118 114 updateVisibleName(); 119 updateItemCountInfo();120 115 updateToolTip(); 121 116 } … … 146 141 147 142 /* Init: */ 143 updateItemCountInfo(); 148 144 updateVisibleName(); 149 updateItemCountInfo();150 145 updateToolTip(); 151 146 } … … 213 208 m_strName = strName; 214 209 215 /* Update visible name: */210 /* Update linked values: */ 216 211 updateVisibleName(); 217 /* Update minimum header size: */218 212 updateMinimumHeaderSize(); 219 213 } … … 458 452 void UIGChooserItemGroup::handleRootStatusChange() 459 453 { 460 /* Update visible name: */454 /* Update linked values: */ 461 455 updateVisibleName(); 462 /* Update minimum header size: */463 456 updateMinimumHeaderSize(); 464 457 } … … 513 506 if (isRoot()) 514 507 iMaximumWidth -= iRootIndent; 515 516 /* Recache visible name: */ 508 /* Calculate new visible name and name-size: */ 517 509 QPaintDevice *pPaintDevice = model()->paintDevice(); 518 m_strVisibleName = isMainRoot() ? QString() : compressText(m_nameFont, pPaintDevice, name(), iMaximumWidth); 519 m_visibleNameSize = isMainRoot() ? QSize(0, 0) : textSize(m_nameFont, pPaintDevice, m_strVisibleName); 520 521 /* Repaint item: */ 522 update(); 510 QString strVisibleName = compressText(m_nameFont, pPaintDevice, name(), iMaximumWidth); 511 QSize visibleNameSize = textSize(m_nameFont, pPaintDevice, strVisibleName); 512 513 /* Update linked values: */ 514 if (m_visibleNameSize != visibleNameSize) 515 { 516 m_visibleNameSize = visibleNameSize; 517 updateGeometry(); 518 } 519 if (m_strVisibleName != strVisibleName) 520 { 521 m_strVisibleName = strVisibleName; 522 update(); 523 } 523 524 } 524 525 525 526 void UIGChooserItemGroup::updateItemCountInfo() 526 527 { 528 /* Not for main root: */ 529 if (isMainRoot()) 530 return; 531 527 532 /* Update item info attributes: */ 528 533 QPaintDevice *pPaintDevice = model()->paintDevice(); 529 m_strInfoGroups = isMainRoot() ||m_groupItems.isEmpty() ? QString() : QString::number(m_groupItems.size());530 m_strInfoMachines = isMainRoot() ||m_machineItems.isEmpty() ? QString() : QString::number(m_machineItems.size());531 m_infoSizeGroups = isMainRoot() ? QSize(0, 0) :textSize(m_infoFont, pPaintDevice, m_strInfoGroups);532 m_infoSizeMachines = isMainRoot() ? QSize(0, 0) :textSize(m_infoFont, pPaintDevice, m_strInfoMachines);534 QString strInfoGroups = m_groupItems.isEmpty() ? QString() : QString::number(m_groupItems.size()); 535 QString strInfoMachines = m_machineItems.isEmpty() ? QString() : QString::number(m_machineItems.size()); 536 QSize infoSizeGroups = textSize(m_infoFont, pPaintDevice, m_strInfoGroups); 537 QSize infoSizeMachines = textSize(m_infoFont, pPaintDevice, m_strInfoMachines); 533 538 534 539 /* Update linked values: */ 535 updateMinimumHeaderSize(); 540 bool fSomethingChanged = false; 541 if (m_strInfoGroups != strInfoGroups) 542 { 543 m_strInfoGroups = strInfoGroups; 544 fSomethingChanged = true; 545 } 546 if (m_strInfoMachines != strInfoMachines) 547 { 548 m_strInfoMachines = strInfoMachines; 549 fSomethingChanged = true; 550 } 551 if (m_infoSizeGroups != infoSizeGroups) 552 { 553 m_infoSizeGroups = infoSizeGroups; 554 fSomethingChanged = true; 555 } 556 if (m_infoSizeMachines != infoSizeMachines) 557 { 558 m_infoSizeMachines = infoSizeMachines; 559 fSomethingChanged = true; 560 } 561 if (fSomethingChanged) 562 { 563 updateVisibleName(); 564 updateMinimumHeaderSize(); 565 } 536 566 } 537 567 … … 577 607 iHeaderWidth += (iMinorSpacing + m_enterButtonSize.width()); 578 608 579 /* Search formaximum height: */609 /* Calculate maximum height: */ 580 610 QList<int> heights; 581 611 /* Button height: */ … … 597 627 iHeaderHeight = qMax(iHeaderHeight, iHeight); 598 628 599 /* Recache minimum header size: */ 600 m_minimumHeaderSize = QSize(iHeaderWidth, iHeaderHeight); 629 /* Calculate new minimum header size: */ 630 QSize minimumHeaderSize = QSize(iHeaderWidth, iHeaderHeight); 631 632 /* Is there something changed? */ 633 if (m_minimumHeaderSize == minimumHeaderSize) 634 return; 601 635 602 636 /* Update linked values: */ 637 m_minimumHeaderSize = minimumHeaderSize; 603 638 updateGeometry(); 604 639 } … … 747 782 } 748 783 749 /* Update: */ 750 updateVisibleName(); 784 /* Update linked values: */ 751 785 updateItemCountInfo(); 752 786 updateToolTip(); 787 updateGeometry(); 753 788 } 754 789 … … 779 814 } 780 815 781 /* Update: */ 782 updateVisibleName(); 816 /* Update linked values: */ 783 817 updateItemCountInfo(); 784 818 updateToolTip(); 819 updateGeometry(); 785 820 } 786 821 … … 795 830 } 796 831 797 /* Update: */ 798 updateVisibleName(); 832 /* Update linked values: */ 799 833 updateItemCountInfo(); 800 834 updateToolTip(); 835 updateGeometry(); 801 836 } 802 837 … … 851 886 } 852 887 853 /* Update: */ 854 updateVisibleName(); 888 /* Update linked values: */ 855 889 updateItemCountInfo(); 856 890 updateToolTip(); 891 updateGeometry(); 857 892 } 858 893 … … 1460 1495 UIGChooserItem::hoverMoveEvent(pEvent); 1461 1496 1462 /* Update visible name: */1497 /* Update linked values: */ 1463 1498 updateVisibleName(); 1464 1499 } … … 1473 1508 UIGChooserItem::hoverLeaveEvent(pEvent); 1474 1509 1475 /* Update visible name: */1510 /* Update linked values: */ 1476 1511 updateVisibleName(); 1477 1512 }
Note:
See TracChangeset
for help on using the changeset viewer.