Changeset 43955 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Nov 26, 2012 8:46:58 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 82297
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
r43885 r43955 157 157 void UIGChooserItem::updateGeometry() 158 158 { 159 /* Call to base-class: */ 159 160 QIGraphicsWidget::updateGeometry(); 161 162 /* Update parent's geometry: */ 163 if (parentItem()) 164 parentItem()->updateGeometry(); 160 165 } 161 166 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
r43954 r43955 930 930 } 931 931 932 void UIGChooserItemGroup::updateGeometry()933 {934 /* Call to base-class: */935 UIGChooserItem::updateGeometry();936 937 /* Update parent's geometry: */938 if (parentItem())939 parentItem()->updateGeometry();940 }941 942 932 void UIGChooserItemGroup::updateLayout() 943 933 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
r43954 r43955 146 146 147 147 /* Helpers: Layout stuff: */ 148 void updateGeometry();149 148 void updateLayout(); 150 149 int minimumWidthHint(bool fOpenedGroup) const; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
r43887 r43955 208 208 /* First row update required? */ 209 209 bool fFirstRowUpdateRequired = false; 210 bool fSecondRowUpdateRequired = false; 210 211 211 212 /* Update pixmap: */ 212 213 QIcon icon = osIcon(); 213 214 QSize iconSize = icon.availableSizes().first(); 214 m_pixmap = icon.pixmap(iconSize); 215 QPixmap pixmap = icon.pixmap(iconSize); 216 if (m_pixmap.toImage() != pixmap.toImage()) 217 { 218 m_pixmap = pixmap; 219 update(); 220 } 215 221 if (m_pixmapSize != iconSize) 216 222 { … … 223 229 QSize stateIconSize = stateIcon.availableSizes().first(); 224 230 m_statePixmap = stateIcon.pixmap(stateIconSize); 231 QPixmap statePixmap = icon.pixmap(stateIconSize); 232 if (m_statePixmap.toImage() != statePixmap.toImage()) 233 { 234 m_statePixmap = statePixmap; 235 update(); 236 } 225 237 if (m_statePixmapSize != stateIconSize) 226 238 { 227 239 m_statePixmapSize = stateIconSize; 240 fSecondRowUpdateRequired = true; 228 241 } 229 242 230 243 /* Update linked values: */ 244 if (fFirstRowUpdateRequired || fSecondRowUpdateRequired) 245 updateGeometry(); 231 246 if (fFirstRowUpdateRequired) 232 247 updateFirstRowMaximumWidth(); … … 297 312 QFontMetrics fm(m_nameFont, pPaintDevice); 298 313 m_iMinimumNameWidth = fm.width(compressText(m_nameFont, pPaintDevice, m_strName, textWidth(m_nameFont, pPaintDevice, 15))); 314 315 /* Update linked values: */ 316 updateGeometry(); 299 317 } 300 318 … … 317 335 } 318 336 319 /* Calculate linked values: */ 337 /* Update linked values: */ 338 updateGeometry(); 320 339 updateMaximumNameWidth(); 321 340 } … … 347 366 m_strVisibleName = compressText(m_nameFont, pPaintDevice, m_strName, m_iMaximumNameWidth); 348 367 m_visibleNameSize = textSize(m_nameFont, pPaintDevice, m_strVisibleName); 368 369 /* Update linked values: */ 370 updateGeometry(); 371 updateMaximumSnapshotNameWidth(); 349 372 update(); 350 351 /* Update linked values: */352 updateMaximumSnapshotNameWidth();353 373 } 354 374 … … 364 384 m_strVisibleSnapshotName = QString("(%1)").arg(strVisibleSnapshotName); 365 385 m_visibleSnapshotNameSize = textSize(m_snapshotNameFont, pPaintDevice, m_strVisibleSnapshotName); 386 387 /* Update linked values: */ 388 updateGeometry(); 366 389 update(); 367 390 } … … 369 392 void UIGChooserItemMachine::updateStateText() 370 393 { 394 /* Something changed? */ 395 QString strStateText = machineStateName(); 396 if (m_strStateText == strStateText) 397 return; 398 371 399 /* Update state text: */ 372 m_strStateText = machineStateName();400 m_strStateText = strStateText; 373 401 m_stateTextSize = textSize(m_stateTextFont, model()->paintDevice(), m_strStateText); 402 403 /* Update linked values: */ 404 updateGeometry(); 374 405 update(); 375 406 } … … 439 470 updateStateText(); 440 471 updateToolTip(); 441 update();442 472 443 473 /* Update parent group-item: */ … … 493 523 void UIGChooserItemMachine::updateLayout() 494 524 { 495 /* Update size-hint for this item: */496 updateGeometry();497 498 525 /* Update tool-bar: */ 499 526 if (m_pToolBar) … … 529 556 int iMachineItemMajorSpacing = data(MachineItemData_MajorSpacing).toInt(); 530 557 int iMachineItemMinorSpacing = data(MachineItemData_MinorSpacing).toInt(); 531 int iMachinePixmapWidth = m_pixmapSize.width();532 int iMachineStatePixmapWidth = m_statePixmapSize.width();533 int iMachineStateTextWidth = m_stateTextSize.width();534 558 int iToolBarWidth = data(MachineItemData_ToolBarSize).toSize().width(); 535 559 … … 543 567 iMachineItemMinorSpacing + 544 568 m_iMinimumSnapshotNameWidth; 545 int iBottomLineWidth = iMachineStatePixmapWidth+569 int iBottomLineWidth = m_statePixmapSize.width() + 546 570 iMachineItemMinorSpacing + 547 iMachineStateTextWidth;571 m_stateTextSize.width(); 548 572 int iRightColumnWidth = qMax(iTopLineWidth, iBottomLineWidth); 549 int iMachineItemWidth = iMachinePixmapWidth+573 int iMachineItemWidth = m_pixmapSize.width() + 550 574 iMachineItemMajorSpacing + 551 575 iRightColumnWidth; … … 563 587 int iMachineItemMargin = data(MachineItemData_Margin).toInt(); 564 588 int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt(); 565 int iMachinePixmapHeight = m_pixmapSize.height();566 int iMachineNameHeight = m_visibleNameSize.height();567 int iSnapshotNameHeight = m_visibleSnapshotNameSize.height();568 int iMachineStatePixmapHeight = m_statePixmapSize.height();569 int iMachineStateTextHeight = m_stateTextSize.height();570 589 int iToolBarHeight = data(MachineItemData_ToolBarSize).toSize().height(); 571 590 … … 576 595 iProposedHeight += 2 * iMachineItemMargin; 577 596 /* And machine-item content to take into account: */ 578 int iTopLineHeight = qMax( iMachineNameHeight, iSnapshotNameHeight);579 int iBottomLineHeight = qMax( iMachineStatePixmapHeight, iMachineStateTextHeight);597 int iTopLineHeight = qMax(m_visibleNameSize.height(), m_visibleSnapshotNameSize.height()); 598 int iBottomLineHeight = qMax(m_statePixmapSize.height(), m_stateTextSize.height()); 580 599 int iRightColumnHeight = iTopLineHeight + 581 582 600 iMachineItemTextSpacing + 601 iBottomLineHeight; 583 602 QList<int> heights; 584 heights << iMachinePixmapHeight<< iRightColumnHeight << iToolBarHeight;603 heights << m_pixmapSize.height() << iRightColumnHeight << iToolBarHeight; 585 604 int iMaxHeight = 0; 586 605 foreach (int iHeight, heights)
Note:
See TracChangeset
for help on using the changeset viewer.